Class: Nanoc::Core::Pattern
- Inherits:
-
Object
- Object
- Nanoc::Core::Pattern
- Includes:
- ContractsSupport
- Defined in:
- lib/nanoc/core/pattern.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #captures(_identifier) ⇒ Object
-
#initialize(_obj) ⇒ Pattern
constructor
A new instance of Pattern.
- #match?(_identifier) ⇒ Boolean
Methods included from ContractsSupport
enabled?, included, setup_once, warn_about_performance
Constructor Details
#initialize(_obj) ⇒ Pattern
Returns a new instance of Pattern.
24 25 26 |
# File 'lib/nanoc/core/pattern.rb', line 24 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 |
# 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
#captures(_identifier) ⇒ Object
32 33 34 |
# File 'lib/nanoc/core/pattern.rb', line 32 def captures(_identifier) raise NotImplementedError end |
#match?(_identifier) ⇒ Boolean
28 29 30 |
# File 'lib/nanoc/core/pattern.rb', line 28 def match?(_identifier) raise NotImplementedError end |