Exception: ComicInfo::Errors::TypeCoercionError

Inherits:
ComicInfoError
  • Object
show all
Defined in:
lib/comicinfo/errors.rb

Overview

Error raised when type coercion fails

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field, value, expected_type) ⇒ TypeCoercionError

Returns a new instance of TypeCoercionError.



49
50
51
52
53
54
# File 'lib/comicinfo/errors.rb', line 49

def initialize field, value, expected_type
  @field = field
  @value = value
  @expected_type = expected_type
  super("Cannot convert value '#{value}' for field '#{field}' to #{expected_type}")
end

Instance Attribute Details

#expected_typeObject (readonly)

Returns the value of attribute expected_type.



47
48
49
# File 'lib/comicinfo/errors.rb', line 47

def expected_type
  @expected_type
end

#fieldObject (readonly)

Returns the value of attribute field.



47
48
49
# File 'lib/comicinfo/errors.rb', line 47

def field
  @field
end

#valueObject (readonly)

Returns the value of attribute value.



47
48
49
# File 'lib/comicinfo/errors.rb', line 47

def value
  @value
end