Class: Nanoc::Int::Pattern Private

Inherits:
Object
  • Object
show all
Includes:
ContractsSupport
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.

Direct Known Subclasses

RegexpPattern, StringPattern

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ContractsSupport

included

Constructor Details

#initialize(_obj) ⇒ Pattern

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 Pattern.

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/nanoc/base/entities/pattern.rb', line 20

def initialize(_obj)
  raise NotImplementedError
end

Class Method Details

.from(obj) ⇒ 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.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/nanoc/base/entities/pattern.rb', line 7

def self.from(obj)
  case obj
  when Nanoc::Int::StringPattern, Nanoc::Int::RegexpPattern
    obj
  when String
    Nanoc::Int::StringPattern.new(obj)
  when Regexp
    Nanoc::Int::RegexpPattern.new(obj)
  else
    raise ArgumentError, "Do not know how to convert `#{obj.inspect}` into a Nanoc::Pattern"
  end
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.

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/nanoc/base/entities/pattern.rb', line 28

def captures(_identifier)
  raise NotImplementedError
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)

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/nanoc/base/entities/pattern.rb', line 24

def match?(_identifier)
  raise NotImplementedError
end