Class: HasSetting::Formatters::BooleanFormatter

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

Instance Method Summary collapse

Methods inherited from NilSafeFormatter

#to_s, #to_type

Instance Method Details

#safe_to_s(value) ⇒ Object



50
51
52
# File 'lib/has_setting/formatters.rb', line 50

def safe_to_s(value)
  value ? '1' : '0'
end

#safe_to_type(value) ⇒ Object



47
48
49
# File 'lib/has_setting/formatters.rb', line 47

def safe_to_type(value)
  value == '1'
end