Class: Promptmenot::Match

Inherits:
Object
  • Object
show all
Defined in:
lib/promptmenot/match.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern:, matched_text:, position:) ⇒ Match

Returns a new instance of Match.



7
8
9
10
11
# File 'lib/promptmenot/match.rb', line 7

def initialize(pattern:, matched_text:, position:)
  @pattern = pattern
  @matched_text = matched_text
  @position = position
end

Instance Attribute Details

#matched_textObject (readonly)

Returns the value of attribute matched_text.



5
6
7
# File 'lib/promptmenot/match.rb', line 5

def matched_text
  @matched_text
end

#patternObject (readonly)

Returns the value of attribute pattern.



5
6
7
# File 'lib/promptmenot/match.rb', line 5

def pattern
  @pattern
end

#positionObject (readonly)

Returns the value of attribute position.



5
6
7
# File 'lib/promptmenot/match.rb', line 5

def position
  @position
end

Instance Method Details

#==(other) ⇒ Object



29
30
31
32
33
34
# File 'lib/promptmenot/match.rb', line 29

def ==(other)
  other.is_a?(Match) &&
    pattern_name == other.pattern_name &&
    matched_text == other.matched_text &&
    position == other.position
end

#categoryObject



13
14
15
# File 'lib/promptmenot/match.rb', line 13

def category
  pattern.category
end

#confidenceObject



21
22
23
# File 'lib/promptmenot/match.rb', line 21

def confidence
  pattern.confidence
end

#pattern_nameObject



17
18
19
# File 'lib/promptmenot/match.rb', line 17

def pattern_name
  pattern.name
end

#sensitivityObject



25
26
27
# File 'lib/promptmenot/match.rb', line 25

def sensitivity
  pattern.sensitivity
end