Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/kube/monkey_patches.rb
Overview
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/kube/monkey_patches.rb', line 3 def method_missing(name, *args) key = name.to_s if key.end_with?("=") self[key.chomp("=").to_sym] = args.first elsif key?(name.to_sym) self[name.to_sym] elsif key.start_with?("to_") super else self[name.to_sym] = {} end end |