Method: SuperSettings.float

Defined in:
lib/super_settings.rb

.float(key, default = nil) ⇒ Float

Get a setting value cast to a float.

Parameters:

  • key (String, Symbol)
  • default (Numeric) (defaults to: nil)

    value to return if the setting value is nil

Returns:

  • (Float)


68
69
70
71
# File 'lib/super_settings.rb', line 68

def float(key, default = nil)
  val = context_setting(key)
  (val.nil? ? default : val)&.to_f
end