Class: Renderer::Template::Bind
Instance Method Summary
collapse
Constructor Details
#initialize(obj, **keys) ⇒ Bind
Returns a new instance of Bind.
4
5
6
7
|
# File 'lib/renderer/template.rb', line 4
def initialize(obj, **keys)
@obj = obj
@keys = keys
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name) ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/renderer/template.rb', line 9
def method_missing(method_name, ...)
if @keys.include? method_name
@keys[method_name]
else
@obj.send(method_name, ...)
end
end
|
Instance Method Details
#make_binding ⇒ Object
21
22
23
|
# File 'lib/renderer/template.rb', line 21
def make_binding
binding
end
|
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
17
18
19
|
# File 'lib/renderer/template.rb', line 17
def respond_to_missing?(method_name, include_private = false)
@keys.key?(method_name.to_s) || @obj.respond_to_missing?(method_name, include_private)
end
|