Class: Nanoc::Core::Pattern
Class Method Summary
collapse
Instance Method Summary
collapse
enabled?, included, setup_once, warn_about_performance
Constructor Details
#initialize(_obj) ⇒ Pattern
Returns a new instance of Pattern.
27
28
29
|
# File 'lib/nanoc/core/pattern.rb', line 27
def initialize(_obj)
raise NotImplementedError
end
|
Class Method Details
.from(obj) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/nanoc/core/pattern.rb', line 9
def self.from(obj)
case obj
when Nanoc::Core::StringPattern, Nanoc::Core::RegexpPattern
obj
when String
Nanoc::Core::StringPattern.new(obj)
when Regexp
Nanoc::Core::RegexpPattern.new(obj)
when Symbol
Nanoc::Core::StringPattern.new(obj.to_s)
else
raise(
ArgumentError,
"Do not know how to convert `#{obj.inspect}` into a Nanoc::Pattern",
)
end
end
|
Instance Method Details
#===(other) ⇒ Object
36
37
38
|
# File 'lib/nanoc/core/pattern.rb', line 36
def ===(other)
match?(other)
end
|
#captures(_identifier) ⇒ Object
40
41
42
|
# File 'lib/nanoc/core/pattern.rb', line 40
def captures(_identifier)
raise NotImplementedError
end
|
#match?(_identifier) ⇒ Boolean
31
32
33
|
# File 'lib/nanoc/core/pattern.rb', line 31
def match?(_identifier)
raise NotImplementedError
end
|