Class: Cuprum::Collections::Errors::UnknownOperator
- Inherits:
-
Error
- Object
- Error
- Cuprum::Collections::Errors::UnknownOperator
- Defined in:
- lib/cuprum/collections/errors/unknown_operator.rb
Overview
An error returned when a query attempts to filter by an unknown operator.
Constant Summary collapse
- TYPE =
Short string used to identify the type of error.
'cuprum.collections.errors.unknown_operator'
Instance Attribute Summary collapse
-
#operator ⇒ String, Symbol
readonly
The unknown operator.
Instance Method Summary collapse
-
#corrections ⇒ Array<String>
Suggested possible values for the operator.
-
#initialize(operator:) ⇒ UnknownOperator
constructor
A new instance of UnknownOperator.
Constructor Details
#initialize(operator:) ⇒ UnknownOperator
Returns a new instance of UnknownOperator.
13 14 15 16 17 18 19 20 |
# File 'lib/cuprum/collections/errors/unknown_operator.rb', line 13 def initialize(operator:) @operator = operator super( message: , operator: operator ) end |
Instance Attribute Details
#operator ⇒ String, Symbol (readonly)
Returns the unknown operator.
23 24 25 |
# File 'lib/cuprum/collections/errors/unknown_operator.rb', line 23 def operator @operator end |
Instance Method Details
#corrections ⇒ Array<String>
Returns Suggested possible values for the operator.
26 27 28 29 30 31 |
# File 'lib/cuprum/collections/errors/unknown_operator.rb', line 26 def corrections @corrections ||= DidYouMean::SpellChecker .new(dictionary: Cuprum::Collections::Queries::VALID_OPERATORS.to_a) .correct(operator) end |