Template
CSV Template implementation. See: ruby-doc.org/stdlib/libdoc/csv/rdoc/CSV.html
# Example of csv template tpl = <<-EOS # header csv << ['NAME', 'ID'] # data rows @people.each do |person| csv << [person[:name], person[:id]] end EOS @people = [ {:name => "Joshua Peek", :id => 1}, {:name => "Ryan Tomayko", :id => 2}, {:name => "Simone Carletti", :id => 3} ] template = Tilt::CSVTemplate.new { tpl } template.render(self)
# File lib/tilt/csv.rb, line 45 def initialize_engine if RUBY_VERSION >= '1.9.0' require_template_library 'csv' else require_template_library 'fastercsv' end end
# File lib/tilt/csv.rb, line 65 def precompiled(locals) source, offset = super [source, offset + 1] end
Generated with the Darkfish Rdoc Generator 2.