Class: Decisive::RenderCSVContext

Inherits:
Struct
  • Object
show all
Defined in:
lib/decisive/render_csv_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#blockObject

Returns the value of attribute block

Returns:

  • (Object)

    the current value of block



6
7
8
# File 'lib/decisive/render_csv_context.rb', line 6

def block
  @block
end

#filenameObject

Returns the value of attribute filename

Returns:

  • (Object)

    the current value of filename



6
7
8
# File 'lib/decisive/render_csv_context.rb', line 6

def filename
  @filename
end

#recordsObject

Returns the value of attribute records

Returns:

  • (Object)

    the current value of records



6
7
8
# File 'lib/decisive/render_csv_context.rb', line 6

def records
  @records
end

Instance Method Details

#csv?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/decisive/render_csv_context.rb', line 13

def csv?
  true
end

#to_csv(*args, **kwargs) ⇒ Object



7
8
9
10
11
# File 'lib/decisive/render_csv_context.rb', line 7

def to_csv(*args, **kwargs)
  Renderer.new(records, block).map do |row|
    row.to_csv(*args, **kwargs)
  end.join
end