Class: PatternRuby::CompiledPattern

Inherits:
Object
  • Object
show all
Defined in:
lib/pattern_ruby/pattern_compiler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_countObject (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_namesObject (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_countObject (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

#regexObject (readonly)

Returns the value of attribute regex.



3
4
5
# File 'lib/pattern_ruby/pattern_compiler.rb', line 3

def regex
  @regex
end

#sourceObject (readonly)

Returns the value of attribute source.



3
4
5
# File 'lib/pattern_ruby/pattern_compiler.rb', line 3

def source
  @source
end

#token_countObject (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