Class: RbTmpl::Tmpl::HashWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/rb-tmpl.rb

Instance Method Summary collapse

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