Method: Funktional::AssignedShouldBlock#initialize

Defined in:
lib/funktional/context/assigned_should_block.rb

#initialize(recorder, context) ⇒ AssignedShouldBlock

Returns a new instance of AssignedShouldBlock.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/funktional/context/assigned_should_block.rb', line 4

def initialize(recorder, context)
  @recorder, @context = recorder, context
  @should_name = "the assigned(#{@recorder.__target})"
  
  @blk = lambda do
    result = nil
    
    recorder.__each_called do |meth, args, block|
      if result.nil?
        result = assigned(recorder.__target).send(meth, *args, &block)
      else
        result.send(meth, *args, &block)
      end
    end
  end
end