Class: ElasticRecord::Merging::Merger
- Inherits:
-
Object
- Object
- ElasticRecord::Merging::Merger
- Defined in:
- lib/elastic_record/relation/merging.rb
Instance Attribute Summary collapse
-
#relation ⇒ Object
Returns the value of attribute relation.
-
#values ⇒ Object
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(relation, other) ⇒ Merger
constructor
A new instance of Merger.
- #merge ⇒ Object
- #normal_values ⇒ Object
Constructor Details
#initialize(relation, other) ⇒ Merger
Returns a new instance of Merger.
15 16 17 18 |
# File 'lib/elastic_record/relation/merging.rb', line 15 def initialize(relation, other) @relation = relation @values = other.values end |
Instance Attribute Details
#relation ⇒ Object
Returns the value of attribute relation.
13 14 15 |
# File 'lib/elastic_record/relation/merging.rb', line 13 def relation @relation end |
#values ⇒ Object
Returns the value of attribute values.
13 14 15 |
# File 'lib/elastic_record/relation/merging.rb', line 13 def values @values end |
Instance Method Details
#merge ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/elastic_record/relation/merging.rb', line 24 def merge normal_values.each do |name| value = values[name] relation.send("#{name}!", value) unless value.blank? end relation end |
#normal_values ⇒ Object
20 21 22 |
# File 'lib/elastic_record/relation/merging.rb', line 20 def normal_values Relation::MULTI_VALUE_METHODS + Relation::SINGLE_VALUE_METHODS end |