Class: AWS::Record::Attributes::FloatAttr
- Defined in:
- lib/aws/record/attributes.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BaseAttr
Class Method Summary collapse
Methods inherited from BaseAttr
#default_value, deserialize, #deserialize, #initialize, #persist_as, #serialize, #set?, #type_cast
Constructor Details
This class inherits a constructor from AWS::Record::Attributes::BaseAttr
Class Method Details
.serialize(float, options = {}) ⇒ Object
240 241 242 |
# File 'lib/aws/record/attributes.rb', line 240 def self.serialize float, = {} expect(Float, float) { float } end |
.type_cast(raw_value, options = {}) ⇒ Object
228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/aws/record/attributes.rb', line 228 def self.type_cast raw_value, = {} case raw_value when nil then nil when '' then nil when Float then raw_value else raw_value.respond_to?(:to_f) ? raw_value.to_f : raw_value.to_s.to_f end end |