class Decisive::StreamContext
Public Class Methods
new(*args, &block)
click to toggle source
Calls superclass method
# File lib/decisive/template_handler.rb, line 187 def initialize *args, &block super instance_eval &block end
Public Instance Methods
column(label, value=nil, &block)
click to toggle source
# File lib/decisive/template_handler.rb, line 192 def column label, value=nil, &block # field, label: field.to_s.humanize, &block value ||= label.parameterize.underscore.to_sym block ||= ->(record) { record.send(value) } columns << Column.new(label, block) end
csv?()
click to toggle source
# File lib/decisive/template_handler.rb, line 209 def csv? true end
each() { |header| ... }
click to toggle source
# File lib/decisive/template_handler.rb, line 198 def each yield header records.map do |record| row = columns.map do |column| column.block.call(record).to_s end yield row end end
Private Instance Methods
header()
click to toggle source
# File lib/decisive/template_handler.rb, line 215 def header columns.map(&:label) end