Class: ElasticRecord::Relation::Merging::Merger
- Inherits:
-
Object
- Object
- ElasticRecord::Relation::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
Constructor Details
#initialize(relation, other) ⇒ Merger
Returns a new instance of Merger.
16 17 18 19 |
# File 'lib/elastic_record/relation/merging.rb', line 16 def initialize(relation, other) @relation = relation @values = other.values end |
Instance Attribute Details
#relation ⇒ Object
Returns the value of attribute relation.
14 15 16 |
# File 'lib/elastic_record/relation/merging.rb', line 14 def relation @relation end |
#values ⇒ Object
Returns the value of attribute values.
14 15 16 |
# File 'lib/elastic_record/relation/merging.rb', line 14 def values @values end |
Instance Method Details
#merge ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/elastic_record/relation/merging.rb', line 21 def merge Relation::SINGLE_VALUE_METHODS.each do |name| value = values[name] relation.send("#{name}!", value) unless value.blank? end Relation::MULTI_VALUE_METHODS.each do |name| value = values[name] relation.send("#{name}!", *value) unless value.blank? end relation end |