class Arugula::RangePart

Public Class Methods

new(start, final) click to toggle source
# File lib/arugula/parts.rb, line 98
def initialize(start, final)
  @range = start..final
end

Public Instance Methods

match(str, index, _match_data) click to toggle source
# File lib/arugula/parts.rb, line 106
def match(str, index, _match_data)
  matches = @range.member?(str[index])
  [matches, index + (matches ? 1 : 0)]
end
to_s() click to toggle source
# File lib/arugula/parts.rb, line 102
def to_s
  "#{@range.begin}-#{@range.end}"
end