lib/prop_check/helper.rb in prop_check-0.18.0 vs lib/prop_check/helper.rb in prop_check-0.18.1
- old
+ new
@@ -31,9 +31,12 @@
def lazy_append(this_enumerator, other_enumerator)
[this_enumerator, other_enumerator].lazy.flat_map(&:lazy)
end
def call_splatted(val, &block)
+ # Handle edge case where Ruby >= 3 behaves differently than Ruby <= 2
+ # c.f. https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/#other-minor-changes-empty-hash
+ return block.call({}) if val.is_a?(Hash) && val.empty?
return block.call(**val) if val.is_a?(Hash) && val.keys.all? { |k| k.is_a?(Symbol) }
block.call(val)
end
end