lib/gm/notepad/table.rb in gm-notepad-0.0.4 vs lib/gm/notepad/table.rb in gm-notepad-0.0.5

- old
+ new

@@ -2,14 +2,11 @@ require "gm/notepad/table_entry" module Gm module Notepad class Table - def initialize(table_name:, lines:, filename: nil, **config) - self.config = config - self.table_name = table_name - self.filename = filename + Configuration.init!(target: self, additional_params: [:table_name, :filename, :lines]) do process(lines: lines) end def lookup(index: false) if index @@ -56,9 +53,10 @@ end def process(lines:) @table = {} lines.each do |line| + next if line[0] == '#' entry = TableEntry.new(line: line, **config) entry.lookup_range.each do |i| key = i.to_s raise DuplicateKeyError.new(key: table_name, object: self) if @table.key?(key) @table[key] = entry