Class: Sprockets::Export::Template
- Inherits:
-
Object
- Object
- Sprockets::Export::Template
- Defined in:
- lib/sprockets/export/template.rb
Constant Summary collapse
- CONTENT =
Pathname.new(__dir__).join("template.js.erb").read
Instance Method Summary collapse
-
#initialize(data = {}) ⇒ Template
constructor
A new instance of Template.
- #render ⇒ Object
Constructor Details
#initialize(data = {}) ⇒ Template
Returns a new instance of Template.
6 7 8 9 10 |
# File 'lib/sprockets/export/template.rb', line 6 def initialize(data = {}) data.each do |key, value| instance_variable_set("@#{key}".to_sym, value) end end |
Instance Method Details
#render ⇒ Object
12 13 14 |
# File 'lib/sprockets/export/template.rb', line 12 def render ERB.new(CONTENT).result(binding) end |