summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Davidovitz <sdavidovitz@zendesk.com>2012-08-31 16:57:55 -0700
committerSteven Davidovitz <sdavidovitz@zendesk.com>2012-08-31 17:03:55 -0700
commitd433d8b1574130f8f3752019ea4db3519c69e6df (patch)
tree665142c188298de2b7b8c10c6d7b8429db25a3f2
parent8dd0fec950c33373c5c954d7ac72df4724334b12 (diff)
downloadhashie-d433d8b1574130f8f3752019ea4db3519c69e6df.tar.gz
don't try and call Object#id when calling Mash#id
Ruby 1.8 has an Object#id method that is called when the Mash doesn't have an id key. This causes unexpected failures since there is no id key-value, but Mash is still returning a value. If the object_id is needed just use Object#object_id or Object#__id__ (Same with type -> class)
-rw-r--r--lib/hashie/mash.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/hashie/mash.rb b/lib/hashie/mash.rb
index c2a5a2d..c4275c5 100644
--- a/lib/hashie/mash.rb
+++ b/lib/hashie/mash.rb
@@ -70,11 +70,11 @@ module Hashie
class << self; alias [] new; end
def id #:nodoc:
- key?("id") ? self["id"] : super
+ self["id"]
end
def type #:nodoc:
- key?("type") ? self["type"] : super
+ self["type"]
end
alias_method :regular_reader, :[]