Class: RR::HashWithObjectIdKey

Inherits:
Hash
  • Object
show all
Defined in:
lib/rr/hash_with_object_id_key.rb

Instance Method Summary collapse

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

#eachObject



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_idObject



3
# File 'lib/rr/hash_with_object_id_key.rb', line 3

alias_method :get_with_object_id, :[]

#include?(key) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/rr/hash_with_object_id_key.rb', line 28

def include?(key)
  super(key.__id__)
end

#keysObject



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_idObject



8
# File 'lib/rr/hash_with_object_id_key.rb', line 8

alias_method :set_with_object_id, :[]=