Exception: Railsmith::BaseService::TypeCoercion::CoercionError
- Inherits:
-
StandardError
- Object
- StandardError
- Railsmith::BaseService::TypeCoercion::CoercionError
- Defined in:
- lib/railsmith/base_service/type_coercion.rb
Overview
Raised when a value cannot be coerced to the requested type.
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(field, type, value) ⇒ CoercionError
constructor
A new instance of CoercionError.
Constructor Details
#initialize(field, type, value) ⇒ CoercionError
Returns a new instance of CoercionError.
32 33 34 35 36 |
# File 'lib/railsmith/base_service/type_coercion.rb', line 32 def initialize(field, type, value) @field = field @type = type super("Cannot coerce #{value.inspect} to #{type} for field '#{field}'") end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
30 31 32 |
# File 'lib/railsmith/base_service/type_coercion.rb', line 30 def field @field end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
30 31 32 |
# File 'lib/railsmith/base_service/type_coercion.rb', line 30 def type @type end |