Class: Lafcadio::DecimalField
- Inherits:
-
ObjectField
- Object
- ObjectField
- Lafcadio::DecimalField
- Defined in:
- lib/lafcadio/objectField/DecimalField.rb
Overview
DecimalField represents a decimal value.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#precision ⇒ Object
readonly
Returns the value of attribute precision.
Attributes inherited from ObjectField
#dbFieldName, #default, #defaultFieldName, #hideDisplay, #hideLabel, #name, #notNull, #notUniqueMsg, #objectType, #unique, #writeOnce
Class Method Summary collapse
-
.instantiateWithParameters(domainClass, parameters) ⇒ Object
:nodoc:.
-
.instantiationParameters(fieldElt) ⇒ Object
:nodoc:.
-
.valueType ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#initialize(objectType, name, precision, englishName = nil) ⇒ DecimalField
constructor
- objectType
-
The domain class that this field belongs to.
-
#processBeforeVerify(value) ⇒ Object
:nodoc:.
-
#valueFromSQL(string, lookupLink = true) ⇒ Object
:nodoc:.
Methods inherited from ObjectField
#<=>, #bind_write?, #dbWillAutomaticallyWrite, #db_table_and_field_name, #englishName, #firstTime, instantiateFromXml, #nameForSQL, #nullErrorMsg, #prevValue, #valueForSQL, #verify, #verifyUniqueness
Constructor Details
#initialize(objectType, name, precision, englishName = nil) ⇒ DecimalField
- objectType
-
The domain class that this field belongs to.
- name
-
The name of this field.
- precision
-
The expected field precision. (Deprecated)
- englishName
-
The English name of this field. (Deprecated)
27 28 29 30 |
# File 'lib/lafcadio/objectField/DecimalField.rb', line 27 def initialize(objectType, name, precision, englishName = nil) super(objectType, name, englishName) @precision = precision end |
Instance Attribute Details
#precision ⇒ Object (readonly)
Returns the value of attribute precision.
6 7 8 |
# File 'lib/lafcadio/objectField/DecimalField.rb', line 6 def precision @precision end |
Class Method Details
.instantiateWithParameters(domainClass, parameters) ⇒ Object
:nodoc:
18 19 20 21 |
# File 'lib/lafcadio/objectField/DecimalField.rb', line 18 def self.instantiateWithParameters( domainClass, parameters ) #:nodoc: self.new( domainClass, parameters['name'], parameters['precision'], parameters['englishName'] ) end |
.instantiationParameters(fieldElt) ⇒ Object
:nodoc:
12 13 14 15 16 |
# File 'lib/lafcadio/objectField/DecimalField.rb', line 12 def DecimalField.instantiationParameters( fieldElt ) #:nodoc: parameters = super( fieldElt ) parameters['precision'] = fieldElt.attributes['precision'].to_i parameters end |
.valueType ⇒ Object
:nodoc:
8 9 10 |
# File 'lib/lafcadio/objectField/DecimalField.rb', line 8 def DecimalField.valueType #:nodoc: Numeric end |
Instance Method Details
#processBeforeVerify(value) ⇒ Object
:nodoc:
36 37 38 39 |
# File 'lib/lafcadio/objectField/DecimalField.rb', line 36 def processBeforeVerify(value) #:nodoc: value = super value value != nil && value != '' ? value.to_f : nil end |
#valueFromSQL(string, lookupLink = true) ⇒ Object
:nodoc:
32 33 34 |
# File 'lib/lafcadio/objectField/DecimalField.rb', line 32 def valueFromSQL(string, lookupLink = true) #:nodoc: string != nil ? string.to_f : nil end |