Module: Tango::MetAndMeet

Included in:
Runner
Defined in:
lib/tango/met_and_meet.rb

Instance Method Summary collapse

Instance Method Details

#meet(&meet_block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/tango/met_and_meet.rb', line 13

def meet(&meet_block)
  # Cache the met block in case something inside the meet
  # block calls another step with another met block:
  met_block = @met_block

  raise MeetWithoutMetError if met_block.nil?

  if instance_eval(&met_block)
    log "already met."
  else
    log "not already met."
    instance_eval(&meet_block)
    if instance_eval(&met_block)
      log "met."
    else
      raise CouldNotMeetError
    end
  end
end

#met?(&met_block) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/tango/met_and_meet.rb', line 9

def met?(&met_block)
  @met_block = met_block
end