mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-20 11:20:41 -07:00
Strainer
- respond_to_missing? is now a required method
This commit is contained in:
@@ -16,6 +16,9 @@ module Liquid
|
|||||||
INTERNAL_METHOD = /^__/
|
INTERNAL_METHOD = /^__/
|
||||||
@@required_methods = Set.new([:__id__, :__send__, :respond_to?, :extend, :methods, :class, :object_id])
|
@@required_methods = Set.new([:__id__, :__send__, :respond_to?, :extend, :methods, :class, :object_id])
|
||||||
|
|
||||||
|
# Ruby 1.9.2 introduces Object#respond_to_missing?, which is invoked by Object#respond_to?
|
||||||
|
@@required_methods << :respond_to_missing? if Object.respond_to? :respond_to_missing?
|
||||||
|
|
||||||
@@filters = {}
|
@@filters = {}
|
||||||
|
|
||||||
def initialize(context)
|
def initialize(context)
|
||||||
|
|||||||
@@ -18,4 +18,9 @@ class StrainerTest < Test::Unit::TestCase
|
|||||||
assert_equal true, strainer.respond_to?('size', false)
|
assert_equal true, strainer.respond_to?('size', false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Asserts that Object#respond_to_missing? is not being undefined in Ruby versions where it has been implemented
|
||||||
|
# Currently this method is only present in Ruby v1.9.2, or higher
|
||||||
|
def test_object_respond_to_missing
|
||||||
|
assert_equal Object.respond_to?(:respond_to_missing?), Strainer.create(nil).respond_to?(:respond_to_missing?)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user