Class: RbTmpl::Tmpl::HashWrapper
- Inherits:
-
Object
- Object
- RbTmpl::Tmpl::HashWrapper
- Defined in:
- lib/rb-tmpl.rb
Instance Method Summary collapse
-
#initialize(hash) ⇒ HashWrapper
constructor
A new instance of HashWrapper.
- #method_missing(method, *arguments, &block) ⇒ Object
- #respond_to(method, include_private) ⇒ Object
Constructor Details
#initialize(hash) ⇒ HashWrapper
Returns a new instance of HashWrapper.
33 34 35 |
# File 'lib/rb-tmpl.rb', line 33 def initialize(hash) @hash = hash end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *arguments, &block) ⇒ Object
37 38 39 |
# File 'lib/rb-tmpl.rb', line 37 def method_missing(method, *arguments, &block) @hash[method] || @hash[method.to_s] end |
Instance Method Details
#respond_to(method, include_private) ⇒ Object
41 42 43 |
# File 'lib/rb-tmpl.rb', line 41 def respond_to(method, include_private) super || @hash.key?(method) || @hash.key?(method.to_s) end |