Class: Rack::ProcessERB

Inherits:
Object
  • Object
show all
Defined in:
lib/rack-denyie.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ProcessERB

Returns a new instance of ProcessERB.



71
72
73
74
# File 'lib/rack-denyie.rb', line 71

def initialize(options = {})
  @options = options
  @erb = ERB.new(::File.read(@options[:template]), nil, "%<>")
end

Instance Method Details

#boundObject



76
77
78
79
80
# File 'lib/rack-denyie.rb', line 76

def bound
  binding = TemplateVars.new(@options).get_binding # Variables passed to ERB template
  @template = @erb.result(binding)
  @template.gsub(/\n$/,'')
end