Class: Spy::Call

Inherits:
Object
  • Object
show all
Defined in:
lib/spy/call.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(receiver, method_name, args, block) ⇒ Call

Returns a new instance of Call


14
15
16
17
18
19
# File 'lib/spy/call.rb', line 14

def initialize(receiver, method_name, args, block)
  @receiver = receiver
  @method_name = method_name
  @args = args
  @block = block
end

Instance Attribute Details

#argsArray<Object> (readonly)

Returns arguments given to the method call

Returns:

  • (Array<Object>)

    arguments given to the method call


9
10
11
# File 'lib/spy/call.rb', line 9

def args
  @args
end

#blockProc (readonly)

Returns block given to the method call, if present

Returns:

  • (Proc)

    block given to the method call, if present


12
13
14
# File 'lib/spy/call.rb', line 12

def block
  @block
end

#method_nameSymbol (readonly)

Returns name of the method called

Returns:

  • (Symbol)

    name of the method called


6
7
8
# File 'lib/spy/call.rb', line 6

def method_name
  @method_name
end

#receiverObject (readonly)

Returns object that received the method call

Returns:

  • (Object)

    object that received the method call


3
4
5
# File 'lib/spy/call.rb', line 3

def receiver
  @receiver
end