Class: Mybot::Template
- Inherits:
-
Object
- Object
- Mybot::Template
- Defined in:
- lib/mybot/template.rb
Instance Method Summary collapse
-
#initialize(tpl) ⇒ Template
constructor
A new instance of Template.
- #render(params = {}) ⇒ Object
Constructor Details
#initialize(tpl) ⇒ Template
Returns a new instance of Template.
6 7 8 |
# File 'lib/mybot/template.rb', line 6 def initialize(tpl) @tpl = tpl end |
Instance Method Details
#render(params = {}) ⇒ Object
10 11 12 |
# File 'lib/mybot/template.rb', line 10 def render(params = {}) ERB.new(@tpl).result(OpenStruct.new(params).instance_eval { binding }) end |