Class: Nanoc::Int::RegexpPattern Private
- 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.
Instance Method Summary collapse
- #captures(identifier) ⇒ Object private
-
#initialize(regexp) ⇒ RegexpPattern
constructor
private
A new instance of RegexpPattern.
- #match?(identifier) ⇒ Boolean private
- #to_s ⇒ Object private
Methods inherited from Pattern
Methods included from ContractsSupport
Constructor Details
#initialize(regexp) ⇒ RegexpPattern
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 RegexpPattern.
61 62 63 |
# File 'lib/nanoc/base/entities/pattern.rb', line 61 def initialize(regexp) @regexp = regexp 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.
71 72 73 74 |
# File 'lib/nanoc/base/entities/pattern.rb', line 71 def captures(identifier) matches = @regexp.match(identifier.to_s) matches && matches.captures 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.
66 67 68 |
# File 'lib/nanoc/base/entities/pattern.rb', line 66 def match?(identifier) (identifier.to_s =~ @regexp) != nil end |
#to_s ⇒ 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.
77 78 79 |
# File 'lib/nanoc/base/entities/pattern.rb', line 77 def to_s @regexp.to_s end |