Class: PatternRuby::CompiledPattern
- Inherits:
-
Object
- Object
- PatternRuby::CompiledPattern
- Defined in:
- lib/pattern_ruby/pattern_compiler.rb
Instance Attribute Summary collapse
-
#entity_count ⇒ Object
readonly
Returns the value of attribute entity_count.
-
#entity_names ⇒ Object
readonly
Returns the value of attribute entity_names.
-
#literal_count ⇒ Object
readonly
Returns the value of attribute literal_count.
-
#regex ⇒ Object
readonly
Returns the value of attribute regex.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#token_count ⇒ Object
readonly
Returns the value of attribute token_count.
Instance Method Summary collapse
-
#initialize(source:, regex:, entity_names:, literal_count:, token_count:, entity_count:) ⇒ CompiledPattern
constructor
A new instance of CompiledPattern.
- #match(input) ⇒ Object
Constructor Details
#initialize(source:, regex:, entity_names:, literal_count:, token_count:, entity_count:) ⇒ CompiledPattern
Returns a new instance of CompiledPattern.
5 6 7 8 9 10 11 12 |
# File 'lib/pattern_ruby/pattern_compiler.rb', line 5 def initialize(source:, regex:, entity_names:, literal_count:, token_count:, entity_count:) @source = source @regex = regex @entity_names = entity_names @literal_count = literal_count @token_count = token_count @entity_count = entity_count end |
Instance Attribute Details
#entity_count ⇒ Object (readonly)
Returns the value of attribute entity_count.
3 4 5 |
# File 'lib/pattern_ruby/pattern_compiler.rb', line 3 def entity_count @entity_count end |
#entity_names ⇒ Object (readonly)
Returns the value of attribute entity_names.
3 4 5 |
# File 'lib/pattern_ruby/pattern_compiler.rb', line 3 def entity_names @entity_names end |
#literal_count ⇒ Object (readonly)
Returns the value of attribute literal_count.
3 4 5 |
# File 'lib/pattern_ruby/pattern_compiler.rb', line 3 def literal_count @literal_count end |
#regex ⇒ Object (readonly)
Returns the value of attribute regex.
3 4 5 |
# File 'lib/pattern_ruby/pattern_compiler.rb', line 3 def regex @regex end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
3 4 5 |
# File 'lib/pattern_ruby/pattern_compiler.rb', line 3 def source @source end |
#token_count ⇒ Object (readonly)
Returns the value of attribute token_count.
3 4 5 |
# File 'lib/pattern_ruby/pattern_compiler.rb', line 3 def token_count @token_count end |
Instance Method Details
#match(input) ⇒ Object
14 15 16 |
# File 'lib/pattern_ruby/pattern_compiler.rb', line 14 def match(input) @regex.match(input) end |