Exception: Railsmith::BaseService::TypeCoercion::CoercionError

Inherits:
StandardError
  • Object
show all
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

Instance Method Summary collapse

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

#fieldObject (readonly)

Returns the value of attribute field.



30
31
32
# File 'lib/railsmith/base_service/type_coercion.rb', line 30

def field
  @field
end

#typeObject (readonly)

Returns the value of attribute type.



30
31
32
# File 'lib/railsmith/base_service/type_coercion.rb', line 30

def type
  @type
end