Class: Kaigara::Metadata::DeepHash
- Inherits:
-
Hash
- Object
- Hash
- Kaigara::Metadata::DeepHash
- Defined in:
- lib/kaigara/metadata.rb
Overview
Storage for nested hashes
Instance Method Summary collapse
-
#method_missing(name, *args, &block) ⇒ Object
Add new variable to a hash, even if it’s in nested one.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
Add new variable to a hash, even if it’s in nested one.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/kaigara/metadata.rb', line 14 def method_missing(name, *args, &block) if name[-1] == '=' key = name[0...-1] self[key] = args.first return self[key] elsif !has_key?(name) self[name] = DeepHash.new end return self[name] end |