Class: HasSetting::Formatters::StrictBooleansFormatter

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



78
79
80
# File 'lib/has_setting/formatters.rb', line 78

def safe_to_s(value)
  Array(value).map() {|item| Formatters.for_type(:strict_boolean).to_s(item)}.join(',')
end

#safe_to_type(value) ⇒ Object



75
76
77
# File 'lib/has_setting/formatters.rb', line 75

def safe_to_type(value)
  value.split(',').map() {|item| Formatters.for_type(:strict_boolean).to_type(item)}
end