mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-09-22 00:00:31 -04:00
Override #respond_to_missing? instead
This commit is contained in:
parent
dc10c1b344
commit
a4b12fac62
@ -102,7 +102,7 @@ module Stripe
|
||||
@values.each(&blk)
|
||||
end
|
||||
|
||||
def respond_to?(symbol)
|
||||
def respond_to_missing?(symbol, include_private = false)
|
||||
@values.has_key?(symbol) || super
|
||||
end
|
||||
|
||||
|
@ -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?(:id)
|
||||
assert obj.respond_to?(:some_key)
|
||||
assert !obj.respond_to?(:some_other_key)
|
||||
assert obj.respond_to_missing?(:id)
|
||||
assert obj.respond_to_missing?(:some_key)
|
||||
assert !obj.respond_to_missing?(:some_other_key)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user