Class: GoodData::LCM2::SmartHash
- Inherits:
-
Hash
show all
- Defined in:
- lib/gooddata/lcm/lcm2.rb
Instance Method Summary
collapse
Methods inherited from Hash
#compact, #deep_merge, #except, #except!, #slice
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *_args) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/gooddata/lcm/lcm2.rb', line 16
def method_missing(name, *_args)
key = name.to_s.downcase.to_sym
value = nil
keys.each do |k|
if k.to_s.downcase.to_sym == key
value = self[k]
break
end
end
if value
value
else
begin
super
rescue
nil
end
end
end
|
Instance Method Details
#key?(key) ⇒ Boolean
38
39
40
41
42
43
44
45
46
|
# File 'lib/gooddata/lcm/lcm2.rb', line 38
def key?(key)
return true if super
keys.each do |k|
return true if k.to_s.downcase.to_sym == key.to_s.downcase.to_sym
end
false
end
|
#respond_to_missing?(name, *_args) ⇒ Boolean
48
49
50
51
|
# File 'lib/gooddata/lcm/lcm2.rb', line 48
def respond_to_missing?(name, *_args)
key = name.to_s.downcase.to_sym
key?(key)
end
|