Class: NoSE::Fields::FloatField
Overview
Field holding a float
Constant Summary collapse
- TYPE =
Any Fixnum is a valid float
Fixnum
Instance Attribute Summary
Attributes inherited from Field
#name, #parent, #primary_key, #size
Class Method Summary collapse
-
.value_from_string(string) ⇒ Object
Parse a Float from the provided parameter.
Instance Method Summary collapse
-
#initialize(name, **options) ⇒ FloatField
constructor
A new instance of FloatField.
-
#random_value ⇒ Object
Random numbers up to the given size.
Methods inherited from Field
#*, #==, #cardinality, #hash, #id, #to_color, #to_s
Methods included from Supertype
Constructor Details
#initialize(name, **options) ⇒ FloatField
Returns a new instance of FloatField.
173 174 175 |
# File 'lib/nose/model/fields.rb', line 173 def initialize(name, **) super(name, 8, **) end |
Class Method Details
.value_from_string(string) ⇒ Object
Parse a Float from the provided parameter
178 179 180 |
# File 'lib/nose/model/fields.rb', line 178 def self.value_from_string(string) string.to_f end |
Instance Method Details
#random_value ⇒ Object
Random numbers up to the given size
183 184 185 |
# File 'lib/nose/model/fields.rb', line 183 def random_value rand(@cardinality).to_f end |