class Kommando::Matchers::Base

Attributes

nested_matchers[R]

Public Class Methods

new(regexp, block) click to toggle source
# File lib/kommando/matchers/base.rb, line 4
def initialize(regexp, block)
  @regexp = regexp
  @block = block

  @nested_matchers = []
end

Public Instance Methods

call(match_data=nil) click to toggle source
# File lib/kommando/matchers/base.rb, line 15
def call(match_data=nil)
  return unless @block
  @block.call match_data
end
every(regexp, &block) click to toggle source
# File lib/kommando/matchers/base.rb, line 26
def every(regexp, &block)
  m = Kommando::Matchers::Every.new regexp, block
  @nested_matchers << m
  m
end
match(string) click to toggle source
# File lib/kommando/matchers/base.rb, line 11
def match(string)
  raise "#match not implemented"
end
once(regexp, &block) click to toggle source
# File lib/kommando/matchers/base.rb, line 20
def once(regexp, &block)
  m = Kommando::Matchers::Once.new regexp, block
  @nested_matchers << m
  m
end