Class: RailsTypedSettings::Types::Float

Inherits:
Base
  • Object
show all
Defined in:
lib/rails_typed_settings/types/float.rb

Class Method Summary collapse

Methods inherited from Base

transform, untransform

Class Method Details

.===(value) ⇒ Object



4
5
6
# File 'lib/rails_typed_settings/types/float.rb', line 4

def self.===(value)
  ::Float === value
end

.coerce(value) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/rails_typed_settings/types/float.rb', line 8

def self.coerce(value)
  return nil if value.nil?
  if [::String, ::Integer, Fixnum].include? value.class
    return value.to_f
  end

  value
end