mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Use symbols in respond_to?
This commit is contained in:
@@ -101,7 +101,7 @@ module Liquid
|
|||||||
ary = InputIterator.new(input)
|
ary = InputIterator.new(input)
|
||||||
if property.nil?
|
if property.nil?
|
||||||
ary.sort
|
ary.sort
|
||||||
elsif ary.first.respond_to?('[]'.freeze) && !ary.first[property].nil?
|
elsif ary.first.respond_to?(:[]) && !ary.first[property].nil?
|
||||||
ary.sort {|a,b| a[property] <=> b[property] }
|
ary.sort {|a,b| a[property] <=> b[property] }
|
||||||
elsif ary.first.respond_to?(property)
|
elsif ary.first.respond_to?(property)
|
||||||
ary.sort {|a,b| a.send(property) <=> b.send(property) }
|
ary.sort {|a,b| a.send(property) <=> b.send(property) }
|
||||||
@@ -114,7 +114,7 @@ module Liquid
|
|||||||
ary = InputIterator.new(input)
|
ary = InputIterator.new(input)
|
||||||
if property.nil?
|
if property.nil?
|
||||||
input.uniq
|
input.uniq
|
||||||
elsif input.first.respond_to?('[]'.freeze)
|
elsif input.first.respond_to?(:[])
|
||||||
input.uniq{ |a| a[property] }
|
input.uniq{ |a| a[property] }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user