Class: Gm::Notepad::TableEntry
- Inherits:
-
Object
- Object
- Gm::Notepad::TableEntry
- Includes:
- Comparable
- Defined in:
- lib/gm/notepad/table_entry.rb
Constant Summary collapse
- NUMBER_RANGE_REGEXP =
%r{(?<left>\d+) *- *(?<right>\d+)}
Instance Attribute Summary collapse
-
#entry_column ⇒ Object
(also: #to_str)
readonly
Returns the value of attribute entry_column.
-
#lookup_column ⇒ Object
readonly
Returns the value of attribute lookup_column.
Instance Method Summary collapse
Instance Attribute Details
#entry_column ⇒ Object Also known as: to_str
Returns the value of attribute entry_column.
24 25 26 |
# File 'lib/gm/notepad/table_entry.rb', line 24 def entry_column @entry_column end |
#lookup_column ⇒ Object
Returns the value of attribute lookup_column.
24 25 26 |
# File 'lib/gm/notepad/table_entry.rb', line 24 def lookup_column @lookup_column end |
Instance Method Details
#<=>(other) ⇒ Object
11 12 13 |
# File 'lib/gm/notepad/table_entry.rb', line 11 def <=>(other) to_str <=> String(other) end |
#lookup_range ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/gm/notepad/table_entry.rb', line 16 def lookup_range if match = NUMBER_RANGE_REGEXP.match(lookup_column) (match[:left].to_i..match[:right].to_i).map(&:to_s) else [lookup_column] end end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/gm/notepad/table_entry.rb', line 26 def to_s "[#{lookup_column}]\t#{entry_column}" end |