Class: Athar::SQL::Render
- Inherits:
-
Object
- Object
- Athar::SQL::Render
- Defined in:
- lib/athar/sql.rb
Instance Method Summary collapse
-
#initialize(locals) ⇒ Render
constructor
A new instance of Render.
- #result(template) ⇒ Object
Constructor Details
#initialize(locals) ⇒ Render
Returns a new instance of Render.
54 55 56 |
# File 'lib/athar/sql.rb', line 54 def initialize(locals) @locals = locals end |
Instance Method Details
#result(template) ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/athar/sql.rb', line 58 def result(template) binding_context = binding @locals.each do |key, value| binding_context.local_variable_set(key, value) end ERB.new(template, trim_mode: "-").result(binding_context) end |