Class: Elastify::Model
- Inherits:
-
Object
- Object
- Elastify::Model
- Defined in:
- lib/elastify/model.rb
Instance Attribute Summary collapse
-
#opt_decode ⇒ Object
Returns the value of attribute opt_decode.
-
#opt_encode ⇒ Object
Returns the value of attribute opt_encode.
-
#opt_index ⇒ Object
Returns the value of attribute opt_index.
-
#opt_mapping ⇒ Object
Returns the value of attribute opt_mapping.
-
#opt_scroll_timeout ⇒ Object
Returns the value of attribute opt_scroll_timeout.
-
#opt_type ⇒ Object
Returns the value of attribute opt_type.
Instance Method Summary collapse
- #decode(&block) ⇒ Object
- #encode(&block) ⇒ Object
- #index(index) ⇒ Object
- #mapping(&block) ⇒ Object
- #mapping_file(file_name) ⇒ Object
- #scroll_timeout(scroll_timeout) ⇒ Object
- #type(type) ⇒ Object
Instance Attribute Details
#opt_decode ⇒ Object
Returns the value of attribute opt_decode.
3 4 5 |
# File 'lib/elastify/model.rb', line 3 def opt_decode @opt_decode end |
#opt_encode ⇒ Object
Returns the value of attribute opt_encode.
3 4 5 |
# File 'lib/elastify/model.rb', line 3 def opt_encode @opt_encode end |
#opt_index ⇒ Object
Returns the value of attribute opt_index.
3 4 5 |
# File 'lib/elastify/model.rb', line 3 def opt_index @opt_index end |
#opt_mapping ⇒ Object
Returns the value of attribute opt_mapping.
3 4 5 |
# File 'lib/elastify/model.rb', line 3 def opt_mapping @opt_mapping end |
#opt_scroll_timeout ⇒ Object
Returns the value of attribute opt_scroll_timeout.
3 4 5 |
# File 'lib/elastify/model.rb', line 3 def opt_scroll_timeout @opt_scroll_timeout end |
#opt_type ⇒ Object
Returns the value of attribute opt_type.
3 4 5 |
# File 'lib/elastify/model.rb', line 3 def opt_type @opt_type end |
Instance Method Details
#decode(&block) ⇒ Object
26 27 28 |
# File 'lib/elastify/model.rb', line 26 def decode(&block) @opt_decode = block if block_given? end |
#encode(&block) ⇒ Object
22 23 24 |
# File 'lib/elastify/model.rb', line 22 def encode(&block) @opt_encode = block if block_given? end |
#index(index) ⇒ Object
5 6 7 |
# File 'lib/elastify/model.rb', line 5 def index(index) @opt_index = index end |
#mapping(&block) ⇒ Object
13 14 15 |
# File 'lib/elastify/model.rb', line 13 def mapping(&block) @opt_mapping = block.call() if block_given? end |
#mapping_file(file_name) ⇒ Object
17 18 19 20 |
# File 'lib/elastify/model.rb', line 17 def mapping_file(file_name) file_path = file_name.instance_of?(Pathname) ? file_name : Rails.root.join('config', 'elastify', 'mappings', file_name) @opt_mapping = JSON.parse(File.read(file_path)).deep_symbolize_keys if File.exist?(file_path) end |
#scroll_timeout(scroll_timeout) ⇒ Object
30 31 32 |
# File 'lib/elastify/model.rb', line 30 def scroll_timeout(scroll_timeout) @opt_scroll_timeout = scroll_timeout end |
#type(type) ⇒ Object
9 10 11 |
# File 'lib/elastify/model.rb', line 9 def type(type) @opt_type = type end |