Sha256: e8170076066e33c2d3472aa3426a2c40d8cfe87362a122af8cff49d8af7e3c1f

Contents?: true

Size: 333 Bytes

Versions: 3

Compression:

Stored size: 333 Bytes

Contents

class Kommando::Matchers::Every < Kommando::Matchers::Base
  def initialize(regexp, block)
    super regexp, block
    @cursor = 0
  end

  def match(string)
    match_data = string[@cursor..-1].match(@regexp)
    @cursor = string.length if match_data
    match_data
  end

  def skip_by(string)
    @cursor = string.length
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kommando-0.1.2 lib/kommando/matchers/every.rb
kommando-0.1.1 lib/kommando/matchers/every.rb
kommando-0.1.0 lib/kommando/matchers/every.rb