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.
60 61 62 |
# File 'lib/athar/sql.rb', line 60 def initialize(locals) @locals = locals end |
Instance Method Details
#result(template) ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/athar/sql.rb', line 64 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 |