Module: ActiveJob::Arguments

Extended by:
Arguments
Included in:
Arguments
Defined in:
activejob/lib/active_job/arguments.rb

Constant Summary collapse

TYPE_WHITELIST =

:nodoc: Calls #uniq since Integer, Fixnum, and Bignum are all the same class on Ruby 2.4+

[ NilClass, String, Integer, Fixnum, Bignum, Float, BigDecimal, TrueClass, FalseClass ].uniq

Instance Method Summary collapse

Instance Method Details

#deserialize(arguments) ⇒ Object

Deserializes a set of arguments. Whitelisted types are returned as-is. Arrays/Hashes are deserialized element by element. All other types are deserialized using GlobalID.


50
51
52
53
54
# File 'activejob/lib/active_job/arguments.rb', line 50

def deserialize(arguments)
  arguments.map { |argument| deserialize_argument(argument) }
rescue
  raise DeserializationError
end

#serialize(arguments) ⇒ Object

Serializes a set of arguments. Whitelisted types are returned as-is. Arrays/Hashes are serialized element by element. All other types are serialized using GlobalID.


43
44
45
# File 'activejob/lib/active_job/arguments.rb', line 43

def serialize(arguments)
  arguments.map { |argument| serialize_argument(argument) }
end