Class: Elasticsearch::Model::Extensions::Configuration
- Inherits:
-
Object
- Object
- Elasticsearch::Model::Extensions::Configuration
- Defined in:
- lib/elasticsearch/model/extensions/configuration.rb
Instance Attribute Summary collapse
-
#delayed ⇒ Object
readonly
Returns the value of attribute delayed.
Instance Method Summary collapse
- #block ⇒ Object
- #field_to_update ⇒ Object
-
#initialize(active_record_class, parent_class: parent_class, delayed:, only_if: -> r { true }, records_to_update_documents: nil, field_to_update: nil, block: nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #only_if ⇒ Object
- #optionally_delayed ⇒ Object
- #records_to_update_documents ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(active_record_class, parent_class: parent_class, delayed:, only_if: -> r { true }, records_to_update_documents: nil, field_to_update: nil, block: nil) ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/elasticsearch/model/extensions/configuration.rb', line 7 def initialize(active_record_class, parent_class: parent_class, delayed:, only_if: -> r { true }, records_to_update_documents: nil, field_to_update: nil, block: nil) @delayed = @delayed @active_record_class = active_record_class @parent_class = parent_class @if = binding.local_variable_get(:only_if) @records_to_update_documents = records_to_update_documents @field_to_update = field_to_update @block = block end |
Instance Attribute Details
#delayed ⇒ Object (readonly)
Returns the value of attribute delayed.
5 6 7 |
# File 'lib/elasticsearch/model/extensions/configuration.rb', line 5 def delayed @delayed end |
Instance Method Details
#block ⇒ Object
38 39 40 |
# File 'lib/elasticsearch/model/extensions/configuration.rb', line 38 def block to_hash[:block] end |
#field_to_update ⇒ Object
22 23 24 |
# File 'lib/elasticsearch/model/extensions/configuration.rb', line 22 def field_to_update to_hash[:field_to_update] end |
#only_if ⇒ Object
26 27 28 |
# File 'lib/elasticsearch/model/extensions/configuration.rb', line 26 def only_if to_hash[:only_if] end |
#optionally_delayed ⇒ Object
34 35 36 |
# File 'lib/elasticsearch/model/extensions/configuration.rb', line 34 def optionally_delayed -> t { delayed ? t.delay : t } end |
#records_to_update_documents ⇒ Object
30 31 32 |
# File 'lib/elasticsearch/model/extensions/configuration.rb', line 30 def records_to_update_documents to_hash[:records_to_update_documents] end |
#to_hash ⇒ Object
18 19 20 |
# File 'lib/elasticsearch/model/extensions/configuration.rb', line 18 def to_hash @cached_hash ||= build_hash end |