class IknowParams::Serializer::Renum

Abstract serializer for `renum` constants.

Public Instance Methods

dump(val, json: nil) click to toggle source
# File lib/iknow_params/serializer.rb, line 341
def dump(val, json: nil)
  matches_type!(val)
  val.name
end
load(str) click to toggle source
# File lib/iknow_params/serializer.rb, line 333
def load(str)
  val = clazz.with_name(str)
  if val.nil?
    raise LoadError.new("Invalid enumeration constant: '#{str}'")
  end
  val
end