Method: Exekutor::Configuration#json_serializer=
- Defined in:
- lib/exekutor/configuration.rb
#json_serializer=(value) ⇒ self
Sets the JSON serializer. This can be either a String
, a Symbol
, a Proc
, or the serializer. If a String
, Symbol
, or Proc
is given, the serializer will be loaded when it is needed for the first time. If the loaded class does not respond to #dump
and #load
an Error will be raised whenever the serializer is loaded. If the value is neither a String
, Symbol
, nor a Proc
and it does not respond to #dump
and #load
, the error will be thrown immediately.
76 77 78 79 80 |
# File 'lib/exekutor/configuration.rb', line 76 define_option :json_serializer, default: "::JSON", required: true do |value| unless value.is_a?(String) || value.is_a?(Symbol) || value.respond_to?(:call) || SerializerValidator.valid?(value) raise Error, "#json_serializer must either be a String, a Proc, or respond to #dump and #load" end end |