Exception: NRSER::CountError
- Inherits:
-
AttrError
- Object
- StandardError
- ValueError
- AttrError
- NRSER::CountError
- Defined in:
- lib/nrser/errors/count_error.rb
Overview
Raised when we expected ‘#count` to be something it’s not.
Extends ValueError, and the #value must be the instance that
Instance Attribute Summary
Attributes inherited from AttrError
Attributes inherited from ValueError
Instance Method Summary collapse
- #count ⇒ Object
-
#initialize(message = nil, subject:, expected:, count: nil) ⇒ CountError
constructor
A new instance of CountError.
Methods inherited from AttrError
#build_message, #has_expected?
Methods inherited from ValueError
Constructor Details
#initialize(message = nil, subject:, expected:, count: nil) ⇒ CountError
Returns a new instance of CountError.
8 9 10 11 12 13 14 |
# File 'lib/nrser/errors/count_error.rb', line 8 def initialize = nil, subject:, expected:, count: nil super , subject: subject, symbol: :count, actual: (count || subject.count), expected: expected end |
Instance Method Details
#count ⇒ Object
16 17 18 |
# File 'lib/nrser/errors/count_error.rb', line 16 def count actual end |