Class: Gm::Notepad::Parameters::TableLookup

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#grepObject

Returns the value of attribute grep.



16
17
18
# File 'lib/gm/notepad/parameters/table_lookup.rb', line 16

def grep
  @grep
end

#indexObject

Returns the value of attribute index.



16
17
18
# File 'lib/gm/notepad/parameters/table_lookup.rb', line 16

def index
  @index
end

#table_nameObject

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

#parametersObject



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