Sha256: 40f3fbd4b810f04efbe6c25e673730116b221c62b72bc58266b9a97f2e94afb1

Contents?: true

Size: 781 Bytes

Versions: 2

Compression:

Stored size: 781 Bytes

Contents

require "gm/notepad/exceptions"
require "gm/notepad/configuration"

module Gm
  module Notepad
    class TableColumnSet
      # Because we may not have an index row, from which we create a TableColumnSet.
      # So this class provides the necessary external interface.
      class Null
        def names
          []
        end
      end

      Configuration.init!(target: self, additional_params: [:table, :line], from_config: [:column_delimiter]) do
        @columns = []
        @index =
        process_line!
      end

      def names
        @columns.map(&:to_s)
      end

      private
      def process_line!
        columns = line.split(column_delimiter)
        @index = columns.shift
        @columns = columns.map {|c| c.strip.downcase }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gm-notepad-0.0.10 lib/gm/notepad/table_column_set.rb
gm-notepad-0.0.9 lib/gm/notepad/table_column_set.rb