Class: Mocha::ArgumentIterator

Inherits:
Object
  • Object
show all
Defined in:
lib/mocha/argument_iterator.rb

Instance Method Summary collapse

Constructor Details

#initialize(argument) ⇒ ArgumentIterator


5
6
7
# File 'lib/mocha/argument_iterator.rb', line 5

def initialize(argument)
  @argument = argument
end

Instance Method Details

#each(&block) ⇒ Object


9
10
11
12
13
14
15
16
17
# File 'lib/mocha/argument_iterator.rb', line 9

def each(&block)
  if @argument.is_a?(Hash) then
    @argument.each do |method_name, return_value|
      block.call(method_name, return_value)
    end
  else
    block.call(@argument)
  end
end