Sha256: 84b2506ff105480b0afc9d4110b322502ddeadad0d5fc5244ed938af4d6e3f1f

Contents?: true

Size: 738 Bytes

Versions: 9

Compression:

Stored size: 738 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)
          unless row.is_a?(::Array)
            raise(IOStreams::Errors::TypeMismatch, "Format is :array. Invalid input: #{row.class.name}")
          end

          row
        end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
iostreams-1.1.0 lib/io_streams/tabular/parser/array.rb
iostreams-1.0.0 lib/io_streams/tabular/parser/array.rb
iostreams-1.0.0.beta7 lib/io_streams/tabular/parser/array.rb
iostreams-1.0.0.beta6 lib/io_streams/tabular/parser/array.rb
iostreams-1.0.0.beta5 lib/io_streams/tabular/parser/array.rb
iostreams-1.0.0.beta4 lib/io_streams/tabular/parser/array.rb
iostreams-1.0.0.beta3 lib/io_streams/tabular/parser/array.rb
iostreams-1.0.0.beta2 lib/io_streams/tabular/parser/array.rb
iostreams-1.0.0.beta lib/io_streams/tabular/parser/array.rb