Class: RailsSettings::Fields::Float

Inherits:
Base
  • Object
show all
Defined in:
lib/rails-settings/fields/float.rb

Constant Summary

Constants inherited from Base

Base::SEPARATOR_REGEXP

Instance Attribute Summary

Attributes inherited from Base

#default, #key, #options, #parent, #readonly, #scope, #separator, #type

Instance Method Summary collapse

Methods inherited from Base

#default_value, generate, #initialize, #read, #save!, #saved_value, #table_exists?, #to_h

Constructor Details

This class inherits a constructor from RailsSettings::Fields::Base

Instance Method Details

#deserialize(value) ⇒ Object



4
5
6
7
8
# File 'lib/rails-settings/fields/float.rb', line 4

def deserialize(value)
  return nil if value.nil?

  value.to_f
end

#serialize(value) ⇒ Object



10
11
12
# File 'lib/rails-settings/fields/float.rb', line 10

def serialize(value)
  deserialize(value)
end