Class: ChatCorrect::PunctuationMasqueradingAsSpellingError

Inherits:
Object
  • Object
show all
Defined in:
lib/chat_correct/punctuation_masquerading_as_spelling_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token_a:, token_b:) ⇒ PunctuationMasqueradingAsSpellingError

Returns a new instance of PunctuationMasqueradingAsSpellingError.



4
5
6
7
# File 'lib/chat_correct/punctuation_masquerading_as_spelling_error.rb', line 4

def initialize(token_a:, token_b:)
  @token_a = token_a
  @token_b = token_b
end

Instance Attribute Details

#token_aObject (readonly)

Returns the value of attribute token_a.



3
4
5
# File 'lib/chat_correct/punctuation_masquerading_as_spelling_error.rb', line 3

def token_a
  @token_a
end

#token_bObject (readonly)

Returns the value of attribute token_b.



3
4
5
# File 'lib/chat_correct/punctuation_masquerading_as_spelling_error.rb', line 3

def token_b
  @token_b
end

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)


9
10
11
12
# File 'lib/chat_correct/punctuation_masquerading_as_spelling_error.rb', line 9

def exists?
  (token_a.include?('ƪ') || token_b.include?('ƪ')) &&
    token_a.delete("ƪ").eql?(token_b.delete("ƪ"))
end