class ActiveAny::Relation::HashMerger

Attributes

hash[R]
relation[R]

Public Class Methods

new(relation, hash) click to toggle source
# File lib/active_any/relation/merger.rb, line 8
def initialize(relation, hash)
  hash.assert_valid_keys(*Relation::VALUE_METHODS)

  @relation = relation
  @hash     = hash
end

Public Instance Methods

merge() click to toggle source
# File lib/active_any/relation/merger.rb, line 15
def merge
  Merger.new(relation, other).merge
end
other() click to toggle source
# File lib/active_any/relation/merger.rb, line 19
def other
  other = Relation.create(relation.klass)
  hash.each { |k, v| other.public_send("#{k}!", v) }
  other
end