Class: Knj::Hash_methods
- Inherits:
-
Hash
show all
- Defined in:
- lib/knj/hash_methods.rb
Instance Method Summary
collapse
Constructor Details
#initialize(hash = {}) ⇒ Hash_methods
Returns a new instance of Hash_methods.
2
3
4
|
# File 'lib/knj/hash_methods.rb', line 2
def initialize(hash = {})
self.update(hash)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
22
23
24
25
26
27
|
# File 'lib/knj/hash_methods.rb', line 22
def method_missing(method, *args)
method = method.to_sym
return self[method] if self.key?(method)
raise "No such method '#{method}' on class '#{self.class.name}'"
end
|
Instance Method Details
14
15
16
|
# File 'lib/knj/hash_methods.rb', line 14
def args
return self[:args]
end
|
18
19
20
|
# File 'lib/knj/hash_methods.rb', line 18
def data
return self[:data]
end
|
6
7
8
|
# File 'lib/knj/hash_methods.rb', line 6
def db
return self[:db]
end
|
10
11
12
|
# File 'lib/knj/hash_methods.rb', line 10
def ob
return self[:ob]
end
|