Exception: TypedArray::UnexpectedTypeException

Inherits:
Exception
  • Object
show all
Defined in:
lib/typed-array.rb

Overview

The exception that is raised when an Unexpected Type is reached during validation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expected_one_of, received) ⇒ UnexpectedTypeException

Returns a new instance of UnexpectedTypeException.



46
47
48
49
# File 'lib/typed-array.rb', line 46

def initialize expected_one_of, received
  @expected = expected_one_of
  @received = received
end

Instance Attribute Details

#expectedObject (readonly)

Provide access to the types of objects expected and the class of the object received



44
45
46
# File 'lib/typed-array.rb', line 44

def expected
  @expected
end

#receivedObject (readonly)

Provide access to the types of objects expected and the class of the object received



44
45
46
# File 'lib/typed-array.rb', line 44

def received
  @received
end

Instance Method Details

#to_sObject



51
52
53
# File 'lib/typed-array.rb', line 51

def to_s
  %{Expected one of #{@expected.inspect} but received a(n) #{@received}}
end