Sha256: a7c8a1f6b9a31d4ffb6122b8e23e9370787ed07528d454377170b50877a0fb76
Contents?: true
Size: 815 Bytes
Versions: 3
Compression:
Stored size: 815 Bytes
Contents
require 'mustermann/pattern' require 'forwardable' module Mustermann # Superclass for patterns that internally compile to a regular expression. # @see Mustermann::Pattern # @abstract class RegexpBased < Pattern # @return [Regexp] regular expression equivalent to the pattern. attr_reader :regexp alias_method :to_regexp, :regexp # @param (see Mustermann::Pattern#initialize) # @return (see Mustermann::Pattern#initialize) # @see (see Mustermann::Pattern#initialize) def initialize(string, **options) super @regexp = compile(**options) end extend Forwardable def_delegators :regexp, :===, :=~, :match, :names, :named_captures def compile(**options) raise NotImplementedError, 'subclass responsibility' end private :compile end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mustermann-0.3.1 | lib/mustermann/regexp_based.rb |
mustermann-0.3.0 | lib/mustermann/regexp_based.rb |
mustermann-0.2.0 | lib/mustermann/regexp_based.rb |