Sha256: 4a9936035d36f5189ad5d892a3d571d61a4a1f0539bb75230d8248b076a5c863

Contents?: true

Size: 712 Bytes

Versions: 20

Compression:

Stored size: 712 Bytes

Contents

require "json"
module IOStreams
  class Tabular
    module Parser
      class Array < Base
        # Returns [Array<String>] the header row.
        # Returns nil if the row is blank.
        def parse_header(row)
          unless row.is_a?(::Array)
            raise(IOStreams::Errors::InvalidHeader, "Format is :array. Invalid input header: #{row.class.name}")
          end

          row
        end

        # Returns Array
        def parse(row)
          raise(IOStreams::Errors::TypeMismatch, "Format is :array. Invalid input: #{row.class.name}") unless row.is_a?(::Array)

          row
        end

        def render(row, header)
          header.to_array(row)
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
iostreams-1.10.3 lib/io_streams/tabular/parser/array.rb
iostreams-1.10.2 lib/io_streams/tabular/parser/array.rb
iostreams-1.10.1 lib/io_streams/tabular/parser/array.rb
iostreams-1.10.0 lib/io_streams/tabular/parser/array.rb
iostreams-1.9.0 lib/io_streams/tabular/parser/array.rb
iostreams-1.8.0 lib/io_streams/tabular/parser/array.rb
iostreams-1.7.0 lib/io_streams/tabular/parser/array.rb
iostreams-1.6.2 lib/io_streams/tabular/parser/array.rb
iostreams-1.6.1 lib/io_streams/tabular/parser/array.rb
iostreams-1.6.0 lib/io_streams/tabular/parser/array.rb
iostreams-1.5.1 lib/io_streams/tabular/parser/array.rb
iostreams-1.5.0 lib/io_streams/tabular/parser/array.rb
iostreams-1.4.0 lib/io_streams/tabular/parser/array.rb
iostreams-1.3.3 lib/io_streams/tabular/parser/array.rb
iostreams-1.3.2 lib/io_streams/tabular/parser/array.rb
iostreams-1.3.1 lib/io_streams/tabular/parser/array.rb
iostreams-1.3.0 lib/io_streams/tabular/parser/array.rb
iostreams-1.2.1 lib/io_streams/tabular/parser/array.rb
iostreams-1.2.0 lib/io_streams/tabular/parser/array.rb
iostreams-1.1.1 lib/io_streams/tabular/parser/array.rb