Class: RR::HashWithObjectIdKey
- Inherits:
-
Hash
- Object
- Hash
- RR::HashWithObjectIdKey
- Defined in:
- lib/rr/hash_with_object_id_key.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #delete(key) ⇒ Object
- #each ⇒ Object
- #get_with_object_id ⇒ Object
- #include?(key) ⇒ Boolean
- #keys ⇒ Object
- #set_with_object_id ⇒ Object
Instance Method Details
#[](key) ⇒ Object
4 5 6 |
# File 'lib/rr/hash_with_object_id_key.rb', line 4 def [](key) super(key.__id__) end |
#[]=(key, value) ⇒ Object
9 10 11 |
# File 'lib/rr/hash_with_object_id_key.rb', line 9 def []=(key, value) super(key.__id__, value) end |
#delete(key) ⇒ Object
19 20 21 |
# File 'lib/rr/hash_with_object_id_key.rb', line 19 def delete(key) super(key.__id__) end |
#each ⇒ Object
13 14 15 16 17 |
# File 'lib/rr/hash_with_object_id_key.rb', line 13 def each super do |object_id, value| yield ObjectSpace._id2ref(object_id), value end end |
#get_with_object_id ⇒ Object
3 |
# File 'lib/rr/hash_with_object_id_key.rb', line 3 alias_method :get_with_object_id, :[] |
#include?(key) ⇒ Boolean
28 29 30 |
# File 'lib/rr/hash_with_object_id_key.rb', line 28 def include?(key) super(key.__id__) end |
#keys ⇒ Object
23 24 25 26 |
# File 'lib/rr/hash_with_object_id_key.rb', line 23 def keys raw_keys = super raw_keys.collect {|raw_key| ObjectSpace._id2ref(raw_key)} end |
#set_with_object_id ⇒ Object
8 |
# File 'lib/rr/hash_with_object_id_key.rb', line 8 alias_method :set_with_object_id, :[]= |