| Class | InstanceVariables |
| In: |
lib/core/facets/kernel/instance_variables.rb
|
| Parent: | Object |
# File lib/core/facets/kernel/instance_variables.rb, line 14
14: def initialize(delegate)
15: @delegate = delegate
16: end
# File lib/core/facets/kernel/instance_variables.rb, line 46
46: def <<(pair)
47: name, value = *pair
48: name = atize(name)
49: @delegate.instance_varaible_set(name, value)
50: end
# File lib/core/facets/kernel/instance_variables.rb, line 36
36: def [](name)
37: name = atize(name)
38: @delegate.instance_variable_get(name)
39: end
# File lib/core/facets/kernel/instance_variables.rb, line 41
41: def []=(name, value)
42: name = atize(name)
43: @delegate.instance_varaible_set(name,value)
44: end
# File lib/core/facets/kernel/instance_variables.rb, line 22
22: def each
23: @delegate.instance_variables.each do |name|
24: yield(name[1..-1].to_sym, @delegate.instance_variable_get(name))
25: end
26: end
# File lib/core/facets/kernel/instance_variables.rb, line 18
18: def instance_delegate
19: @delegate
20: end
# File lib/core/facets/kernel/instance_variables.rb, line 58
58: def keys
59: @delegate.instance_variables.collect do |name|
60: name[1..-1].to_sym
61: end
62: end
# File lib/core/facets/kernel/instance_variables.rb, line 64
64: def names
65: @delegate.instance_variables.collect do |name|
66: name[1..-1]
67: end
68: end
# File lib/core/facets/kernel/instance_variables.rb, line 28
28: def to_hash
29: h = {}
30: each do |name, value|
31: h[name] = value
32: end
33: h
34: end
# File lib/core/facets/kernel/instance_variables.rb, line 52
52: def update(hash)
53: hash.each do |pair|
54: self << pair
55: end
56: end
# File lib/core/facets/kernel/instance_variables.rb, line 70
70: def values
71: @delegate.instance_variables.collect do |name|
72: @delegate.instance_variable_get(name)
73: end
74: end