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.



119
120
121
# File 'lib/iknow_params/serializer.rb', line 119

def initialize
  super(::Float)
end

Instance Method Details

#load(str) ⇒ Object



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

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