Class: RubyExpect::AnyMatch

Inherits:
Match
  • Object
show all
Defined in:
lib/ruby_expect/procedure.rb

Overview

Expect any one of the specified patterns and call the matching pattern's block

Instance Method Summary collapse

Methods inherited from Match

#expect, #initialize

Constructor Details

This class inherits a constructor from RubyExpect::Match

Instance Method Details

#runObject

Procedure input data for the set of expected patterns


80
81
82
83
84
85
86
# File 'lib/ruby_expect/procedure.rb', line 80

def run
  retval = @exp.expect(*@patterns.collect {|p| p.pattern})
  unless (retval.nil?)
    @exp.instance_eval(&@patterns[retval].block) unless (@patterns[retval].block.nil?)
  end
  return retval
end