class Virtus::CoercionError
Attributes
attribute[R]
output[R]
Public Class Methods
new(output, attribute)
click to toggle source
Calls superclass method
# File lib/virtus.rb, line 16 def initialize(output, attribute) @output, @attribute = output, attribute super(build_message) end
Public Instance Methods
attribute_name()
click to toggle source
# File lib/virtus.rb, line 29 def attribute_name attribute.options[:name] end
attribute_name?()
click to toggle source
# File lib/virtus.rb, line 33 def attribute_name? attribute_name ? true : false end
build_message()
click to toggle source
# File lib/virtus.rb, line 21 def build_message if attribute_name? "Failed to coerce attribute `#{attribute_name}' from #{output.inspect} into #{target_type}" else "Failed to coerce #{output.inspect} into #{target_type}" end end
target_type()
click to toggle source
# File lib/virtus.rb, line 37 def target_type attribute.primitive.inspect end