Parent

Methods

Newgem::QuickTemplate

Attributes

args[R]
file[R]
text[R]

Public Class Methods

new(file) click to toggle source
# File lib/newgem/quick_template.rb, line 6
def initialize(file)
  @file = file
  @text = File.read(file)
end

Public Instance Methods

exec(b) click to toggle source
# File lib/newgem/quick_template.rb, line 10
def exec(b)
  begin
    # b = binding
    template = ERB.new(@text, 0, "%<>")
    result = template.result(b)
    # Chomp the trailing newline
    result.gsub(/\n$/,'')
  rescue NameError
    puts "Error found for #{file}"
    raise $!
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.