# 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
# File lib/newgem/quick_template.rb, line 6 def initialize(file) @file = file @text = File.read(file) end