Class: Tanker::ModelConfig
- Inherits:
-
Object
- Object
- Tanker::ModelConfig
- Defined in:
- lib/tanker.rb
Instance Attribute Summary collapse
-
#index_name ⇒ Object
Returns the value of attribute index_name.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #functions(&block) ⇒ Object
- #index ⇒ Object
- #indexes(field = nil, &block) ⇒ Object
-
#initialize(index_name, options, block) ⇒ ModelConfig
constructor
A new instance of ModelConfig.
- #variables(&block) ⇒ Object
Constructor Details
#initialize(index_name, options, block) ⇒ ModelConfig
Returns a new instance of ModelConfig.
272 273 274 275 276 277 278 279 |
# File 'lib/tanker.rb', line 272 def initialize(index_name, , block) @index_name = index_name @options = @indexes = [] @variables = [] @functions = {} instance_exec &block end |
Instance Attribute Details
#index_name ⇒ Object
Returns the value of attribute index_name.
269 270 271 |
# File 'lib/tanker.rb', line 269 def index_name @index_name end |
#options ⇒ Object
Returns the value of attribute options.
270 271 272 |
# File 'lib/tanker.rb', line 270 def @options end |
Instance Method Details
#functions(&block) ⇒ Object
291 292 293 294 |
# File 'lib/tanker.rb', line 291 def functions(&block) @functions = block.call if block @functions end |
#index ⇒ Object
296 297 298 |
# File 'lib/tanker.rb', line 296 def index @index ||= Tanker.api.get_index(index_name) end |
#indexes(field = nil, &block) ⇒ Object
281 282 283 284 |
# File 'lib/tanker.rb', line 281 def indexes(field = nil, &block) @indexes << [field, block] if field @indexes end |
#variables(&block) ⇒ Object
286 287 288 289 |
# File 'lib/tanker.rb', line 286 def variables(&block) @variables << block if block @variables end |