Class: Nanoc::Core::StringPattern

Inherits:
Pattern
  • Object
show all
Defined in:
lib/nanoc/core/string_pattern.rb

Constant Summary collapse

MATCH_OPTS =
File::FNM_PATHNAME | File::FNM_EXTGLOB

Instance Method Summary collapse

Methods inherited from Pattern

from

Methods included from ContractsSupport

enabled?, included, setup_once, warn_about_performance

Constructor Details

#initialize(string) ⇒ StringPattern

Returns a new instance of StringPattern.



9
10
11
# File 'lib/nanoc/core/string_pattern.rb', line 9

def initialize(string)
  @string = string
end

Instance Method Details

#captures(_identifier) ⇒ Object



19
20
21
# File 'lib/nanoc/core/string_pattern.rb', line 19

def captures(_identifier)
  nil
end

#match?(identifier) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/nanoc/core/string_pattern.rb', line 14

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

#to_sObject



24
25
26
# File 'lib/nanoc/core/string_pattern.rb', line 24

def to_s
  @string
end