diff options
author | Jerry Cheung <jollyjerry@gmail.com> | 2013-02-11 17:34:27 -0800 |
---|---|---|
committer | Jerry Cheung <jollyjerry@gmail.com> | 2013-02-11 17:34:27 -0800 |
commit | 419446a77b566140f2eb2257aa9db97d2d15ead6 (patch) | |
tree | 01a8fba030a611c4ca5c4bd6520f8f3093927427 /lib | |
parent | fec979fe5af1a4dd214eb6f2cd24182d21f81013 (diff) | |
parent | 28e0c267601a0be9595fff9d369f412edf528367 (diff) | |
download | hashie-419446a77b566140f2eb2257aa9db97d2d15ead6.tar.gz |
Merge pull request #62 from dlupu/master
enhance respond_to? method
Diffstat (limited to 'lib')
-rw-r--r-- | lib/hashie/extensions/method_access.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/hashie/extensions/method_access.rb b/lib/hashie/extensions/method_access.rb index 50ee46c..39539a5 100644 --- a/lib/hashie/extensions/method_access.rb +++ b/lib/hashie/extensions/method_access.rb @@ -27,7 +27,7 @@ module Hashie # # user.not_declared # => NoMethodError module MethodReader - def respond_to?(name) + def respond_to?(name, include_private = false) return true if key?(name.to_s) || key?(name.to_sym) super end @@ -57,7 +57,7 @@ module Hashie # h['awesome'] # => 'sauce' # module MethodWriter - def respond_to?(name) + def respond_to?(name, include_private = false) return true if name.to_s =~ /=$/ super end @@ -96,7 +96,7 @@ module Hashie # h.def? # => false # h.hji? # => NoMethodError module MethodQuery - def respond_to?(name) + def respond_to?(name, include_private = false) return true if name.to_s =~ /(.*)\?$/ && (key?($1) || key?($1.to_sym)) super end |