class TableStructure::Writer
Public Class Methods
new( schema, header: { context: nil, step: nil }, method: :<<, row_type: :array )
click to toggle source
# File lib/table_structure/writer.rb, line 5 def initialize( schema, header: { context: nil, step: nil }, method: :<<, row_type: :array ) @schema = schema @options = { header: header, method: method, row_type: row_type } end
Public Instance Methods
write( items, to:, method: @options[:method], &block )
click to toggle source
# File lib/table_structure/writer.rb, line 19 def write( items, to:, method: @options[:method], &block ) output = Output.new(to, method: method) Iterator .new( @schema, header: @options[:header], row_type: @options[:row_type] ) .iterate(items, &block) .each { |row| output.write(row) } nil end