Class: MVCLI::ERB::Template
- Inherits:
-
Object
- Object
- MVCLI::ERB::Template
- Defined in:
- lib/mvcli/erb.rb
Instance Method Summary collapse
- #call(this, output) ⇒ Object
-
#initialize(code, enc, filename) ⇒ Template
constructor
A new instance of Template.
- #to_proc ⇒ Object
Constructor Details
#initialize(code, enc, filename) ⇒ Template
Returns a new instance of Template.
26 27 28 |
# File 'lib/mvcli/erb.rb', line 26 def initialize(code, enc, filename) @code, @enc, @filename = code, enc, filename end |
Instance Method Details
#call(this, output) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/mvcli/erb.rb', line 30 def call(this, output) context = Context.new this binding = context.instance_eval do @_erbout = output Kernel.binding end eval @code, binding, @filename, 1 end |
#to_proc ⇒ Object
39 40 41 42 43 |
# File 'lib/mvcli/erb.rb', line 39 def to_proc proc do |context, output| call context, output end end |