Class: AWS::Record::Attributes::FloatAttr
Instance Attribute Summary
Attributes inherited from BaseAttr
#name, #options
Class Method Summary
collapse
Methods inherited from BaseAttr
#default_value, deserialize, #deserialize, #initialize, #persist_as, #serialize, #set?, #type_cast
Class Method Details
.allow_set? ⇒ Boolean
245
246
247
|
# File 'lib/aws/record/attributes.rb', line 245
def self.allow_set?
true
end
|
.serialize(float, options = {}) ⇒ Object
240
241
242
|
# File 'lib/aws/record/attributes.rb', line 240
def self.serialize float, options = {}
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, options = {}
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
|