lib/polyfill/v2_3/hash.rb in polyfill-1.2.0 vs lib/polyfill/v2_3/hash.rb in polyfill-1.3.0
- old
+ new
@@ -1,7 +1,35 @@
module Polyfill
module V2_3
module Hash
+ def <(other)
+ other = InternalUtils.to_hash(other)
+
+ return false if size == other.size
+
+ all? { |k, v| other[k] == v }
+ end
+
+ def <=(other)
+ other = InternalUtils.to_hash(other)
+
+ all? { |k, v| other[k] == v }
+ end
+
+ def >(other)
+ other = InternalUtils.to_hash(other)
+
+ return false if size == other.size
+
+ other.all? { |k, v| self[k] == v }
+ end
+
+ def >=(other)
+ other = InternalUtils.to_hash(other)
+
+ other.all? { |k, v| self[k] == v }
+ end
+
def dig(head, *rest)
[head, *rest].reduce(self) do |value, accessor|
next_value =
case value
when ::Array