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.
14 15 16 |
# File 'lib/fear/extractor/pattern.rb', line 14 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.
11 12 13 |
# File 'lib/fear/extractor/pattern.rb', line 11 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.
35 36 37 |
# File 'lib/fear/extractor/pattern.rb', line 35 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.
39 40 41 |
# File 'lib/fear/extractor/pattern.rb', line 39 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.
43 44 45 |
# File 'lib/fear/extractor/pattern.rb', line 43 def failure_reason(other) matcher.failure_reason(other).get_or_else { 'It matches' } end |