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.
295 296 297 298 299 300 301 302 |
# File 'lib/tanker.rb', line 295 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.
292 293 294 |
# File 'lib/tanker.rb', line 292 def index_name @index_name end |
#options ⇒ Object
Returns the value of attribute options.
293 294 295 |
# File 'lib/tanker.rb', line 293 def @options end |
Instance Method Details
#functions(&block) ⇒ Object
314 315 316 317 |
# File 'lib/tanker.rb', line 314 def functions(&block) @functions = block.call if block @functions end |
#index ⇒ Object
319 320 321 |
# File 'lib/tanker.rb', line 319 def index @index ||= Tanker.api.get_index(index_name) end |
#indexes(field = nil, &block) ⇒ Object
304 305 306 307 |
# File 'lib/tanker.rb', line 304 def indexes(field = nil, &block) @indexes << [field, block] if field @indexes end |
#variables(&block) ⇒ Object
309 310 311 312 |
# File 'lib/tanker.rb', line 309 def variables(&block) @variables << block if block @variables end |