Class: Lafcadio::FloatField

Inherits:
ObjectField show all
Defined in:
lib/lafcadio/objectField.rb

Overview

FloatField represents a decimal value.

Instance Attribute Summary

Attributes inherited from ObjectField

#db_field_name, #domain_class, #mock_value, #name, #not_nil

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ObjectField

#<=>, #bind_write?, create_from_xml, create_with_args, creation_parameters, #db_column, #db_will_automatically_write?, #default_mock_value, #initialize, #prev_value, #value_for_sql, #verify, #verify_non_nil_value

Constructor Details

This class inherits a constructor from Lafcadio::ObjectField

Class Method Details

.mock_valueObject

:nodoc:



308
309
310
# File 'lib/lafcadio/test.rb', line 308

def FloatField.mock_value #:nodoc:
	0.0
end

.value_typeObject

:nodoc:



485
486
487
# File 'lib/lafcadio/objectField.rb', line 485

def self.value_type #:nodoc:
	Numeric
end

Instance Method Details

#process_before_verify(value) ⇒ Object

:nodoc:



489
490
491
492
# File 'lib/lafcadio/objectField.rb', line 489

def process_before_verify(value) #:nodoc:
	value = super value
	value != nil && value != '' ? value.to_f : nil
end

#value_from_sql(string, lookupLink = true) ⇒ Object

:nodoc:



494
495
496
# File 'lib/lafcadio/objectField.rb', line 494

def value_from_sql(string, lookupLink = true) #:nodoc:
	string != nil ? string.to_f : nil
end