class Decisive::RenderContext
Public Instance Methods
csv?()
click to toggle source
# File lib/decisive/template_handler.rb, line 227 def csv? true end
to_csv(*args, **kwargs)
click to toggle source
# File lib/decisive/template_handler.rb, line 221 def to_csv(*args, **kwargs) (header + body).map do |row| row.to_csv(*args, **kwargs) end.join end
Private Instance Methods
body()
click to toggle source
# File lib/decisive/template_handler.rb, line 237 def body hashes.map do |hash| hash.values_at(*keys) end end
hashes()
click to toggle source
# File lib/decisive/template_handler.rb, line 247 def hashes @hashes ||= records.map do |record| Row.new(record, block).to_hash end end
header()
click to toggle source
# File lib/decisive/template_handler.rb, line 233 def header [keys] end
keys()
click to toggle source
# File lib/decisive/template_handler.rb, line 243 def keys @keys ||= hashes.flat_map(&:keys).uniq end