Class: RubyExpect::Match
- Inherits:
-
Object
- Object
- RubyExpect::Match
- Defined in:
- lib/ruby_expect/procedure.rb
Overview
Super class for common methods for AnyMatch and EachMatch
Instance Method Summary collapse
-
#expect(pattern, &block) ⇒ Object
Add a pattern to be expected by the process.
-
#initialize(exp_object, &block) ⇒ Match
constructor
exp_object-
The expect object used for interaction.
Constructor Details
#initialize(exp_object, &block) ⇒ Match
exp_object-
The expect object used for interaction
block-
The block will be called in the context of the initialized match object
52 53 54 55 56 |
# File 'lib/ruby_expect/procedure.rb', line 52 def initialize exp_object, &block @exp = exp_object @patterns = [] instance_eval(&block) unless block.nil? end |
Instance Method Details
#expect(pattern, &block) ⇒ Object
Add a pattern to be expected by the process
pattern-
String or Regexp to match on
block-
Block to be called upon a match
67 68 69 |
# File 'lib/ruby_expect/procedure.rb', line 67 def expect pattern, &block @patterns.push(Pattern.new(pattern, &block)) end |