class NRSER::CountError

Raised when we expected `#count` to be something it's not.

Public Class Methods

new(*message, **kwds) click to toggle source

Create a new {CountError}.

@param [Array] message

See {NicerError#initialize}.

@param [Hash<Symbol, Object>] kwds

Except as called out below, other keywords are passed up to 
{NicerError#initialize}.

@option kwds [Object] :value

The value that has the bad `#count`.

@option kwds [Integer | NRSER::Types::Type | String] :expected

Encouraged to be one of:

1.  An exact {Integer} that you were looking for.

2.  A {NRSER::Types::Type} satisfied by what you would have been satisfied
    with.

3.  A {String} explanation of the condition.

@option kwds [Integer] :actual

The actual count.
Calls superclass method
# File lib/nrser/errors/count_error.rb, line 51
def initialize *message, **kwds
  kwds[:actual] = kwds.delete( :count ) if kwds.key?( :count )
  super *message, **kwds, name: :count
end

Public Instance Methods

count() click to toggle source

Alias for {#actual}.

# File lib/nrser/errors/count_error.rb, line 60
def count; actual; end
count?() click to toggle source

Alias for {#actual?}.

# File lib/nrser/errors/count_error.rb, line 57
def count?; actual?; end