Class: Kommando::Matchers::Every
- Defined in:
- lib/kommando/matchers/every.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(regexp, block) ⇒ Every
constructor
A new instance of Every.
- #match(string) ⇒ Object
- #skip_by(string) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(regexp, block) ⇒ Every
Returns a new instance of Every.
2 3 4 5 |
# File 'lib/kommando/matchers/every.rb', line 2 def initialize(regexp, block) super regexp, block @cursor = 0 end |
Instance Method Details
#match(string) ⇒ Object
7 8 9 10 11 |
# File 'lib/kommando/matchers/every.rb', line 7 def match(string) match_data = string[@cursor..-1].match(@regexp) @cursor = string.length if match_data match_data end |
#skip_by(string) ⇒ Object
13 14 15 |
# File 'lib/kommando/matchers/every.rb', line 13 def skip_by(string) @cursor = string.length end |