Class: Gm::Notepad::Parameters::TableLookup
- Inherits:
-
Object
- Object
- Gm::Notepad::Parameters::TableLookup
- Defined in:
- lib/gm/notepad/parameters/table_lookup.rb
Overview
Responsible for teasing apart the table logic
Constant Summary collapse
- WITH_GREP_REGEXP =
%r{(?<declaration>\/(?<grep>[^\/]+)/)}- WITH_INDEX_REGEXP =
%r{(?<declaration>\[(?<index>[^\]]+)\])}- WITH_EMPTY_INDEX_REGEX =
%r{(?<declaration>\[\])}- WITH_EMPTY_GREP_REGEX =
%r{(?<declaration>\/\/)}
Instance Attribute Summary collapse
-
#grep ⇒ Object
Returns the value of attribute grep.
-
#index ⇒ Object
Returns the value of attribute index.
-
#table_name ⇒ Object
Returns the value of attribute table_name.
Instance Method Summary collapse
-
#initialize(text:) ⇒ TableLookup
constructor
A new instance of TableLookup.
- #parameters ⇒ Object
Constructor Details
#initialize(text:) ⇒ TableLookup
Returns a new instance of TableLookup.
11 12 13 14 |
# File 'lib/gm/notepad/parameters/table_lookup.rb', line 11 def initialize(text:) @text = text extract_parameters! end |
Instance Attribute Details
#grep ⇒ Object
Returns the value of attribute grep.
16 17 18 |
# File 'lib/gm/notepad/parameters/table_lookup.rb', line 16 def grep @grep end |
#index ⇒ Object
Returns the value of attribute index.
16 17 18 |
# File 'lib/gm/notepad/parameters/table_lookup.rb', line 16 def index @index end |
#table_name ⇒ Object
Returns the value of attribute table_name.
16 17 18 |
# File 'lib/gm/notepad/parameters/table_lookup.rb', line 16 def table_name @table_name end |
Instance Method Details
#parameters ⇒ Object
18 19 20 21 22 23 |
# File 'lib/gm/notepad/parameters/table_lookup.rb', line 18 def parameters parameters = { table_name: table_name } parameters[:grep] = grep if grep parameters[:index] = index if index parameters end |