lib/suggest.rb in suggest_rb-0.4.0 vs lib/suggest.rb in suggest_rb-0.5.0
- old
+ new
@@ -64,10 +64,14 @@
next if block && UNSAFE_WITH_BLOCK.include?([m.owner, m.name])
result = post.__send__(allow_not_public ? :send : :public_send, m.name, *args, &block) rescue next
next unless allow_mutation || self == post
- Suggest.eq?(result, expected)
+ if expected.is_a?(Proc) && expected.lambda?
+ expected.call(result)
+ else
+ Suggest.eq?(result, expected)
+ end
end.map(&:name)
end
def what_mutates?(expected, args: [], allow_not_public: false, **opts, &block)
methods.map(&method(:method)).select(&SELECTOR).select do |m|