Module: Gm::Notepad::TableEntry

Defined in:
lib/gm/notepad/table_entry.rb

Defined Under Namespace

Classes: Base, OrLess, OrMore

Constant Summary collapse

OR_LESS_REGEXP =
%r{\A(?<floor>\d+) or less}i.freeze
OR_MORE_REGEXP =
%r{\A(?<ceiling>\d+) or more}i.freeze

Class Method Summary collapse

Class Method Details

.new(line:, table:, **kwargs) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/gm/notepad/table_entry.rb', line 10

def self.new(line:, table:, **kwargs)
  if match = line.match(OR_LESS_REGEXP)
    OrLess.new(line: line, table: table, floor: match[:floor], **kwargs)
  elsif match = line.match(OR_MORE_REGEXP)
    OrMore.new(line: line, table: table, ceiling: match[:ceiling], **kwargs)
  else
    Base.new(line: line, table: table, **kwargs)
  end
end