Sha256: f60eb94499019f7addf2030877c11fa21e5f6eeb9bce495d391becf9e15b5f22

Contents?: true

Size: 314 Bytes

Versions: 5

Compression:

Stored size: 314 Bytes

Contents

# frozen_string_literal: true

require 'regexgen/version'
require 'regexgen/trie'

# Generate regular expressions that match a set of strings
module Regexgen
  class <<self
    def generate(strings, flags = nil)
      Trie.new.tap { |t| strings.each(&t.method(:add)) }
          .to_regex(flags)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
regexgen-0.3.0 lib/regexgen.rb
regexgen-0.2.1 lib/regexgen.rb
regexgen-0.2.0 lib/regexgen.rb
regexgen-0.1.1 lib/regexgen.rb
regexgen-0.1.0 lib/regexgen.rb