Class: Sprockets::Export::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/sprockets/export/template.rb

Constant Summary collapse

CONTENT =
Pathname.new(__dir__).join("template.js.erb").read

Instance Method Summary collapse

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

#renderObject



12
13
14
# File 'lib/sprockets/export/template.rb', line 12

def render
  ERB.new(CONTENT).result(binding)
end