Class: Tengu::ReceiveMatcher

Inherits:
Matcher
  • Object
show all
Defined in:
lib/tengu/receive_matcher.rb

Instance Attribute Summary

Attributes inherited from Matcher

#description

Instance Method Summary collapse

Methods inherited from Matcher

#matches?

Constructor Details

#initialize(method_message, message, &block) ⇒ ReceiveMatcher

Returns a new instance of ReceiveMatcher.



5
6
7
8
9
10
# File 'lib/tengu/receive_matcher.rb', line 5

def initialize(method_message, message, &block)
  @method_message = method_message
  @message = message
  @with = nil
  super(message, &block)
end

Instance Method Details

#with(*args) ⇒ Object



12
13
14
15
16
# File 'lib/tengu/receive_matcher.rb', line 12

def with(*args)
  method_message = @method_message
  @block = -> (object) { object._tengu_received?(method_message, args) }
  self
end