Class: TableSaw::Manifest::Table
- Inherits:
-
Object
- Object
- TableSaw::Manifest::Table
- Defined in:
- lib/table_saw/manifest.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
Instance Method Summary collapse
-
#has_many ⇒ Object
rubocop:disable Naming/PredicateName.
-
#initialize(variables, config) ⇒ Table
constructor
A new instance of Table.
- #query ⇒ Object
- #table ⇒ Object (also: #name)
Constructor Details
#initialize(variables, config) ⇒ Table
Returns a new instance of Table.
10 11 12 13 |
# File 'lib/table_saw/manifest.rb', line 10 def initialize(variables, config) @variables = variables @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/table_saw/manifest.rb', line 8 def config @config end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
8 9 10 |
# File 'lib/table_saw/manifest.rb', line 8 def variables @variables end |
Instance Method Details
#has_many ⇒ Object
rubocop:disable Naming/PredicateName
30 31 32 |
# File 'lib/table_saw/manifest.rb', line 30 def has_many config.fetch('has_many', []) end |
#query ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/table_saw/manifest.rb', line 21 def query if config['query'] format(config['query'], variables.transform_keys(&:to_sym)) else "select id from #{table}" end end |
#table ⇒ Object Also known as: name
15 16 17 |
# File 'lib/table_saw/manifest.rb', line 15 def table config['table'] end |