class SimpleCachedSettings::SettingSerializer

Constants

ALLOWED_VALUE_TYPES

Public Class Methods

dump(value) click to toggle source
# File lib/simple_cached_settings/setting_serializer.rb, line 12
def dump(value)
  if ALLOWED_VALUE_TYPES.any? { |t| value.is_a?(t) }
    YAML.dump(value)
  else
    raise SettingTypeNotAllowed, "Setting values of type #{value.class} not allowed"
  end
end
load(value) click to toggle source
# File lib/simple_cached_settings/setting_serializer.rb, line 8
def load(value)
  YAML.load(value) if value
end