class Nanoc::Core::RegexpPattern

Public Class Methods

new(regexp) click to toggle source
# File lib/nanoc/core/regexp_pattern.rb, line 7
def initialize(regexp)
  @regexp = regexp
end

Public Instance Methods

captures(identifier) click to toggle source
# File lib/nanoc/core/regexp_pattern.rb, line 17
def captures(identifier)
  matches = @regexp.match(identifier.to_s)
  matches&.captures
end
match?(identifier) click to toggle source
# File lib/nanoc/core/regexp_pattern.rb, line 12
def match?(identifier)
  (identifier.to_s =~ @regexp) != nil
end
to_s() click to toggle source
# File lib/nanoc/core/regexp_pattern.rb, line 23
def to_s
  @regexp.to_s
end