Class: Fear::Extractor::Pattern Private
- Inherits:
-
Object
- Object
- Fear::Extractor::Pattern
- Defined in:
- lib/fear/extractor/pattern.rb
Overview
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.
Parse pattern. Used within Fear[]
Constant Summary collapse
- DEFAULT_PATTERN_CACHE_SIZE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
10_000
Class Attribute Summary collapse
- .pattern_cache ⇒ Object readonly private
Instance Method Summary collapse
- #===(other) ⇒ Object private
- #and_then(other) ⇒ Object private
- #failure_reason(other) ⇒ Object private
-
#initialize(pattern) ⇒ Pattern
constructor
private
A new instance of Pattern.
Constructor Details
#initialize(pattern) ⇒ 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.
16 17 18 |
# File 'lib/fear/extractor/pattern.rb', line 16 def initialize(pattern) @matcher = compile_pattern(pattern) end |
Class Attribute Details
.pattern_cache ⇒ Object (readonly)
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.
13 14 15 |
# File 'lib/fear/extractor/pattern.rb', line 13 def pattern_cache @pattern_cache end |
Instance Method Details
#===(other) ⇒ 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.
37 38 39 |
# File 'lib/fear/extractor/pattern.rb', line 37 def ===(other) matcher.defined_at?(other) end |
#and_then(other) ⇒ 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.
41 42 43 |
# File 'lib/fear/extractor/pattern.rb', line 41 def and_then(other) Fear::PartialFunction::Combined.new(matcher, other) end |
#failure_reason(other) ⇒ 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.
45 46 47 |
# File 'lib/fear/extractor/pattern.rb', line 45 def failure_reason(other) matcher.failure_reason(other).get_or_else { "It matches" } end |