Class: IknowParams::Serializer::Numeric

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

#initializeNumeric

Returns a new instance of Numeric.



163
164
165
# File 'lib/iknow_params/serializer.rb', line 163

def initialize
  super(::Numeric)
end

Instance Method Details

#load(str) ⇒ Object



167
168
169
170
171
# File 'lib/iknow_params/serializer.rb', line 167

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