Class: NoSE::Fields::FloatField
Overview
Field holding a float
Constant Summary collapse
- TYPE =
Float
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.
184 185 186 |
# File 'lib/nose/model/fields.rb', line 184 def initialize(name, **) super(name, 8, **) end |
Class Method Details
.value_from_string(string) ⇒ Object
Parse a Float from the provided parameter
189 190 191 |
# File 'lib/nose/model/fields.rb', line 189 def self.value_from_string(string) string.to_f end |
Instance Method Details
#random_value ⇒ Object
Random numbers up to the given size
194 195 196 |
# File 'lib/nose/model/fields.rb', line 194 def random_value rand(@cardinality).to_f end |