Class: IknowParams::Serializer::Float

Inherits:
IknowParams::Serializer show all
Defined in:
lib/iknow_params/serializer.rb

Instance Attribute Summary

Attributes inherited from IknowParams::Serializer

#clazz

Instance Method Summary collapse

Methods inherited from IknowParams::Serializer

#dump, for, for!, json_value?, #matches_type!, #matches_type?, singleton

Constructor Details

#initializeFloat

Returns a new instance of Float.



123
124
125
# File 'lib/iknow_params/serializer.rb', line 123

def initialize
  super(::Float)
end

Instance Method Details

#load(str) ⇒ Object



127
128
129
130
131
# File 'lib/iknow_params/serializer.rb', line 127

def load(str)
  Float(str)
rescue TypeError, ArgumentError => _e
  raise LoadError.new("Invalid type for conversion to Float")
end