Sha256: 648453cbc308c4234b61f334cad419f790afab96d5707f68e2681bba4d4a0bba

Contents?: true

Size: 394 Bytes

Versions: 1

Compression:

Stored size: 394 Bytes

Contents

# frozen_string_literal: true
class Arugula
  require 'arugula/version'

  autoload :Parser, 'arugula/parser'

  def initialize(pattern)
    @root = Parser.new(pattern).parse!
  end

  def match?(str, index = 0)
    loop do
      match, = @root.match(str, index)
      return index if match
      index += 1
      return if index > str.size
    end
  end

  def to_s
    "/#{@root}/"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
arugula-0.2.1 lib/arugula.rb