Class: ChatCorrect::Pluralization
- Inherits:
-
Object
- Object
- ChatCorrect::Pluralization
- Defined in:
- lib/chat_correct/pluralization.rb
Instance Attribute Summary collapse
-
#token_a ⇒ Object
readonly
Returns the value of attribute token_a.
-
#token_b ⇒ Object
readonly
Returns the value of attribute token_b.
Instance Method Summary collapse
-
#initialize(token_a:, token_b:) ⇒ Pluralization
constructor
A new instance of Pluralization.
- #pluralization_error? ⇒ Boolean
Constructor Details
#initialize(token_a:, token_b:) ⇒ Pluralization
Returns a new instance of Pluralization.
4 5 6 7 |
# File 'lib/chat_correct/pluralization.rb', line 4 def initialize(token_a:, token_b:) @token_a = token_a @token_b = token_b end |
Instance Attribute Details
#token_a ⇒ Object (readonly)
Returns the value of attribute token_a.
3 4 5 |
# File 'lib/chat_correct/pluralization.rb', line 3 def token_a @token_a end |
#token_b ⇒ Object (readonly)
Returns the value of attribute token_b.
3 4 5 |
# File 'lib/chat_correct/pluralization.rb', line 3 def token_b @token_b end |
Instance Method Details
#pluralization_error? ⇒ Boolean
9 10 11 12 13 14 15 16 17 |
# File 'lib/chat_correct/pluralization.rb', line 9 def pluralization_error? begin token_a_plural = token_a.en.plural token_b_plural = token_b.en.plural rescue return false end token_a_plural.eql?(token_b) || token_b_plural.eql?(token_a) end |