Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/hashd/hash.rb
Instance Attribute Summary collapse
-
#dot ⇒ Object
Returns the value of attribute dot.
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/hashd/hash.rb', line 9 def method_missing(name, *args, &block) return super(name, *args, &block) unless dot if name[-1] == '=' self[name[0..-2].to_sym] = args[0] else self[name] || self[name.to_s] end end |
Instance Attribute Details
#dot ⇒ Object
Returns the value of attribute dot.
3 4 5 |
# File 'lib/hashd/hash.rb', line 3 def dot @dot end |
Instance Method Details
#to_dot ⇒ Object
5 6 7 |
# File 'lib/hashd/hash.rb', line 5 def to_dot dotify(self); self end |