Exception: Rasti::Form::MultiCastError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rasti/form/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, value, errors) ⇒ MultiCastError

Returns a new instance of MultiCastError.



30
31
32
33
34
# File 'lib/rasti/form/errors.rb', line 30

def initialize(type, value, errors)
  @type = type
  @value = value
  @errors = errors
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



28
29
30
# File 'lib/rasti/form/errors.rb', line 28

def errors
  @errors
end

#typeObject (readonly)

Returns the value of attribute type.



28
29
30
# File 'lib/rasti/form/errors.rb', line 28

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



28
29
30
# File 'lib/rasti/form/errors.rb', line 28

def value
  @value
end

Instance Method Details

#display_valueObject



40
41
42
# File 'lib/rasti/form/errors.rb', line 40

def display_value
  value.is_a?(::String) ? "'#{value}'" : value.inspect
end

#messageObject



36
37
38
# File 'lib/rasti/form/errors.rb', line 36

def message
  "Invalid cast: #{display_value} -> #{type} - #{JSON.dump(errors)}"
end