mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-29 07:05:12 -07:00
remove unnecessary flatten filter
This commit is contained in:
@@ -127,11 +127,6 @@ module Liquid
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# flatten the given input
|
|
||||||
def flatten(input)
|
|
||||||
Array(input).flatten
|
|
||||||
end
|
|
||||||
|
|
||||||
# Replace occurrences of a string with another
|
# Replace occurrences of a string with another
|
||||||
def replace(input, string, replacement = ''.freeze)
|
def replace(input, string, replacement = ''.freeze)
|
||||||
input.to_s.gsub(string, replacement.to_s)
|
input.to_s.gsub(string, replacement.to_s)
|
||||||
|
|||||||
@@ -163,16 +163,6 @@ class StandardFiltersTest < Test::Unit::TestCase
|
|||||||
assert_template_result "42", template, "thing" => hash
|
assert_template_result "42", template, "thing" => hash
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_flatten
|
|
||||||
assert_equal [1,2,3,4], @filters.flatten([1,2,3,4])
|
|
||||||
assert_equal [1,2,3,4], @filters.flatten([[1,2,3,4]])
|
|
||||||
assert_equal [1,2,3,4], @filters.flatten([[1],[2],[3],[4]])
|
|
||||||
assert_equal [1], @filters.flatten(1)
|
|
||||||
|
|
||||||
assert_template_result '1234', "{{ ary | flatten | flatten }}",
|
|
||||||
'ary' => [[1],2,[3],4]
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_sort_calls_to_liquid
|
def test_sort_calls_to_liquid
|
||||||
t = TestThing.new
|
t = TestThing.new
|
||||||
Liquid::Template.parse('{{ foo | sort: "whatever" }}').render("foo" => [t])
|
Liquid::Template.parse('{{ foo | sort: "whatever" }}').render("foo" => [t])
|
||||||
|
|||||||
Reference in New Issue
Block a user