Class: Nanoc::Int::StringPattern Private

Inherits:
Pattern
  • Object
show all
Defined in:
lib/nanoc/base/entities/pattern.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

MATCH_OPTS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

File::FNM_PATHNAME | File::FNM_EXTGLOB

Instance Method Summary collapse

Methods inherited from Pattern

from

Methods included from ContractsSupport

included

Constructor Details

#initialize(string) ⇒ StringPattern

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of StringPattern.



38
39
40
# File 'lib/nanoc/base/entities/pattern.rb', line 38

def initialize(string)
  @string = string
end

Instance Method Details

#captures(_identifier) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



48
49
50
# File 'lib/nanoc/base/entities/pattern.rb', line 48

def captures(_identifier)
  nil
end

#match?(identifier) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


43
44
45
# File 'lib/nanoc/base/entities/pattern.rb', line 43

def match?(identifier)
  File.fnmatch(@string, identifier.to_s, MATCH_OPTS)
end

#to_sObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



53
54
55
# File 'lib/nanoc/base/entities/pattern.rb', line 53

def to_s
  @string
end