Class: HasSetting::Formatters::FloatFormatter

Inherits:
NilSafeFormatter show all
Defined in:
lib/has_setting/formatters.rb

Overview

Formatter for float values Throws ArgumentError if value can not be converted

Instance Method Summary collapse

Methods inherited from NilSafeFormatter

#to_s, #to_type

Instance Method Details

#safe_to_s(value) ⇒ Object



135
136
137
# File 'lib/has_setting/formatters.rb', line 135

def safe_to_s(value)
  Float(value).to_s
end

#safe_to_type(value) ⇒ Object



132
133
134
# File 'lib/has_setting/formatters.rb', line 132

def safe_to_type(value)
  Float(value)
end