Class: Virtus::Attributes::Float

Inherits:
Numeric show all
Defined in:
lib/virtus/attributes/float.rb

Constant Summary

Constants inherited from Attribute

Attribute::DEFAULT_ACCESSOR, Attribute::OPTIONS

Instance Attribute Summary

Attributes inherited from Attribute

#instance_variable_name, #model, #name, #options, #reader_visibility, #writer_visibility

Instance Method Summary collapse

Methods included from Typecast::Numeric

#typecast_to_numeric

Methods inherited from Attribute

#_create_reader, #_create_writer, accept_options, accepted_options, #complex?, descendants, #get, #get!, inherited, #initialize, options, #primitive?, #set, #set!, #typecast

Constructor Details

This class inherits a constructor from Virtus::Attributes::Attribute

Instance Method Details

#typecast_to_primitive(value, model = nil) ⇒ Float

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Typecast a value to a Float

Parameters:

  • value (#to_str, #to_f)

    value to typecast

Returns:

  • (Float)

    Float constructed from value



15
16
17
# File 'lib/virtus/attributes/float.rb', line 15

def typecast_to_primitive(value, model = nil)
  typecast_to_numeric(value, :to_f)
end