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
- #categories(field = nil, options = {}, &block) ⇒ Object
- #category(field = nil, options = {}, &block) ⇒ Object
- #functions(&block) ⇒ Object
- #index ⇒ Object
- #indexes(field = nil, options = {}, &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
282 283 284 285 286 287 288 289 290 |
# File 'lib/tanker.rb', line 282 def initialize(index_name, , block) @index_name = index_name = @indexes = [] @categories = [] @variables = [] @functions = {} instance_exec &block end |
Instance Attribute Details
#index_name ⇒ Object
Returns the value of attribute index_name.
279 280 281 |
# File 'lib/tanker.rb', line 279 def index_name @index_name end |
#options ⇒ Object
Returns the value of attribute options.
280 281 282 |
# File 'lib/tanker.rb', line 280 def end |
Instance Method Details
#categories(field = nil, options = {}, &block) ⇒ Object
304 305 306 307 308 309 |
# File 'lib/tanker.rb', line 304 def categories(field = nil, = {}, &block) if field @categories << [field, block] end @categories end |
#category(field = nil, options = {}, &block) ⇒ Object
300 301 302 |
# File 'lib/tanker.rb', line 300 def category(field = nil, = {}, &block) categories field, , &block end |
#functions(&block) ⇒ Object
316 317 318 319 |
# File 'lib/tanker.rb', line 316 def functions(&block) @functions = block.call if block @functions end |
#index ⇒ Object
321 322 323 |
# File 'lib/tanker.rb', line 321 def index @index ||= Tanker.api.get_index(index_name) end |
#indexes(field = nil, options = {}, &block) ⇒ Object
292 293 294 295 296 297 298 |
# File 'lib/tanker.rb', line 292 def indexes(field = nil, = {}, &block) if field @indexes << [field, block] @categories << [field, block] if [:category] end @indexes end |
#variables(&block) ⇒ Object
311 312 313 314 |
# File 'lib/tanker.rb', line 311 def variables(&block) @variables << block if block @variables end |