mirror of
https://github.com/Shopify/liquid.git
synced 2026-10-02 16:45:12 -07:00
Merge pull request #306 from Shopify/default_to_s_for_drops
Liquid::Drop should not return a string representation of standard ruby objects
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
## 3.0.0 / not yet released / branch "master"
|
## 3.0.0 / not yet released / branch "master"
|
||||||
|
|
||||||
* ...
|
* ...
|
||||||
|
* Add a to_s default for liquid drops, see #306 [Adam Doeler, releod]
|
||||||
* Add strip, lstrip, and rstrip to standard filters [Florian Weingarten, fw42]
|
* Add strip, lstrip, and rstrip to standard filters [Florian Weingarten, fw42]
|
||||||
* Make if, for & case tags return complete and consistent nodelists, see #250 [Nick Jones, dntj]
|
* Make if, for & case tags return complete and consistent nodelists, see #250 [Nick Jones, dntj]
|
||||||
* Prevent arbitrary method invocation on condition objects, see #274 [Dylan Thacker-Smith, dylanahsmith]
|
* Prevent arbitrary method invocation on condition objects, see #274 [Dylan Thacker-Smith, dylanahsmith]
|
||||||
|
|||||||
@@ -52,6 +52,10 @@ module Liquid
|
|||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s
|
||||||
|
self.class.name
|
||||||
|
end
|
||||||
|
|
||||||
alias :[] :invoke_drop
|
alias :[] :invoke_drop
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -237,4 +237,9 @@ class DropsTest < Test::Unit::TestCase
|
|||||||
def test_nil_value_access
|
def test_nil_value_access
|
||||||
assert_equal '', Liquid::Template.parse('{{ product[value] }}').render('product' => ProductDrop.new, 'value' => nil)
|
assert_equal '', Liquid::Template.parse('{{ product[value] }}').render('product' => ProductDrop.new, 'value' => nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_default_to_s_on_drops
|
||||||
|
assert_equal 'ProductDrop', Liquid::Template.parse("{{ product }}").render('product' => ProductDrop.new)
|
||||||
|
assert_equal 'EnumerableDrop', Liquid::Template.parse('{{ collection }}').render('collection' => EnumerableDrop.new)
|
||||||
|
end
|
||||||
end # DropsTest
|
end # DropsTest
|
||||||
|
|||||||
Reference in New Issue
Block a user