lib/rom/repository/changeset/update.rb in rom-repository-1.3.2 vs lib/rom/repository/changeset/update.rb in rom-repository-1.3.3
- old
+ new
@@ -39,20 +39,10 @@
# @api public
def original
@original ||= Hash(relation.one)
end
- # Return diff hash sent through the pipe
- #
- # @return [Hash]
- #
- # @api public
- def to_h
- pipe.call(diff)
- end
- alias_method :to_hash, :to_h
-
# Return true if there's a diff between original and changeset data
#
# @return [TrueClass, FalseClass]
#
# @api public
@@ -75,11 +65,12 @@
#
# @api public
def diff
@diff ||=
begin
- data_tuple = __data__.to_a
- data_keys = __data__.keys & original.keys
+ data = pipe.for_diff(__data__)
+ data_tuple = data.to_a
+ data_keys = data.keys & original.keys
new_tuple = data_tuple.to_a.select { |(k, _)| data_keys.include?(k) }
ori_tuple = original.to_a.select { |(k, _)| data_keys.include?(k) }
Hash[new_tuple - (new_tuple & ori_tuple)]