Class: Tilt::CSVTemplate

Inherits:
Template show all
Defined in:
lib/tilt/csv.rb

Instance Attribute Summary

Attributes inherited from Template

#compiled_path, #data, #file, #line, #options

Instance Method Summary collapse

Methods inherited from Template

#basename, #compiled_method, default_mime_type, default_mime_type=, #eval_file, #fixed_locals?, #initialize, #metadata, metadata, #name, #render

Constructor Details

This class inherits a constructor from Tilt::Template

Instance Method Details

#precompiled(locals) ⇒ Object



57
58
59
60
# File 'lib/tilt/csv.rb', line 57

def precompiled(locals)
  source, offset = super
  [source, offset + 1]
end

#precompiled_template(locals) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/tilt/csv.rb', line 49

def precompiled_template(locals)
  <<-RUBY
    #{@outvar} = CSV.generate(**#{@options}) do |csv|
      #{@data}
    end
  RUBY
end

#prepareObject



45
46
47
# File 'lib/tilt/csv.rb', line 45

def prepare
  @outvar = @options.delete(:outvar) || '_csvout'
end