lib/hash_diff.rb in hash_diff-0.7.0 vs lib/hash_diff.rb in hash_diff-0.8.0
- old
+ new
@@ -1,26 +1,26 @@
require "hash_diff/version"
require "hash_diff/comparison"
module HashDiff
- class << self
- def diff(*args)
- Comparison.new(*args).diff
- end
+ def self.patch!
+ Hash.class_eval do
+ def diff(right)
+ HashDiff.left_diff(self, right)
+ end
+ end unless Hash.new.respond_to?(:diff)
+ end
- def left_diff(*args)
- Comparison.new(*args).left_diff
- end
+ module_function
- def right_diff(*args)
- Comparison.new(*args).right_diff
- end
+ def diff(*args)
+ Comparison.new(*args).diff
+ end
- def patch!
- Hash.class_eval do
- def diff right
- HashDiff.left_diff self, right
- end
- end unless self.class.respond_to? :diff
- end
+ def left_diff(*args)
+ Comparison.new(*args).left_diff
+ end
+
+ def right_diff(*args)
+ Comparison.new(*args).right_diff
end
end