Class: Hash
- Inherits:
-
Object
show all
- Defined in:
- lib/NIFTY.rb
Overview
Hashの値をドット表記で取得可能とするための、Hashクラスに独自のメソッド定義を行う
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
31
32
33
34
35
|
# File 'lib/NIFTY.rb', line 31
def method_missing(meth, *args, &block)
if args.size == 0
self[meth.to_s] || self[meth.to_sym]
end
end
|
Instance Method Details
#does_not_have?(key) ⇒ Boolean
45
46
47
|
# File 'lib/NIFTY.rb', line 45
def does_not_have?(key)
self[key].nil? || self[key].to_s.empty?
end
|
#has?(key) ⇒ Boolean
41
42
43
|
# File 'lib/NIFTY.rb', line 41
def has?(key)
self[key] && !self[key].to_s.empty?
end
|
#type ⇒ Object
37
38
39
|
# File 'lib/NIFTY.rb', line 37
def type
self['type']
end
|