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.



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

def initialize(options = {})
  @options = options
  @options.each_pair do |key, value|
    self.instance_variable_set("@#{key}", value)
  end
  @erb = ERB.new(::File.read(@options[:template]), nil, "%<>")
end

Instance Method Details

#boundObject



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

def bound
  @template = @erb.result(binding)
  @template.gsub(/\n$/,'')
end