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[]
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.
17 18 19 |
# File 'lib/fear/extractor/pattern.rb', line 17 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.
14 15 16 |
# File 'lib/fear/extractor/pattern.rb', line 14 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.
38 39 40 |
# File 'lib/fear/extractor/pattern.rb', line 38 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.
42 43 44 |
# File 'lib/fear/extractor/pattern.rb', line 42 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.
46 47 48 |
# File 'lib/fear/extractor/pattern.rb', line 46 def failure_reason(other) matcher.failure_reason(other).get_or_else { "It matches" } end |