mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-09-22 00:00:31 -04:00
Fall back to #respond_to? if ruby version is lower than 1.9.2
This commit is contained in:
parent
a4b12fac62
commit
6a7f705be3
@ -102,8 +102,14 @@ module Stripe
|
||||
@values.each(&blk)
|
||||
end
|
||||
|
||||
def respond_to_missing?(symbol, include_private = false)
|
||||
@values.has_key?(symbol) || super
|
||||
if RUBY_VERSION < '1.9.2'
|
||||
def respond_to?(symbol)
|
||||
@values.has_key(symbol) || super
|
||||
end
|
||||
else
|
||||
def respond_to_missing?(symbol, include_private = false)
|
||||
@values.has_key?(symbol) || super
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
@ -5,9 +5,9 @@ module Stripe
|
||||
should "implement #respond_to correctly" do
|
||||
obj = Stripe::StripeObject.construct_from({ :some_key => "something", :id => 123 })
|
||||
|
||||
assert obj.respond_to_missing?(:id)
|
||||
assert obj.respond_to_missing?(:some_key)
|
||||
assert !obj.respond_to_missing?(:some_other_key)
|
||||
assert obj.respond_to?(:id)
|
||||
assert obj.respond_to?(:some_key)
|
||||
assert !obj.respond_to?(:some_other_key)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user