lib/active_job/arguments.rb in activejob-6.1.7.10 vs lib/active_job/arguments.rb in activejob-7.0.0.alpha1
- old
+ new
@@ -5,22 +5,22 @@
module ActiveJob
# Raised when an exception is raised during job arguments deserialization.
#
# Wraps the original exception raised as +cause+.
class DeserializationError < StandardError
- def initialize #:nodoc:
+ def initialize # :nodoc:
super("Error while trying to deserialize arguments: #{$!.message}")
set_backtrace $!.backtrace
end
end
# Raised when an unsupported argument type is set as a job argument. We
# currently support String, Integer, Float, NilClass, TrueClass, FalseClass,
# BigDecimal, Symbol, Date, Time, DateTime, ActiveSupport::TimeWithZone,
# ActiveSupport::Duration, Hash, ActiveSupport::HashWithIndifferentAccess,
- # Array or GlobalID::Identification instances, although this can be extended
- # by adding custom serializers.
+ # Array, Range or GlobalID::Identification instances, although this can be
+ # extended by adding custom serializers.
# Raised if you set the key for a Hash something else than a string or
# a symbol. Also raised when trying to serialize an object which can't be
# identified with a GlobalID - such as an unpersisted Active Record model.
class SerializationError < ArgumentError; end
@@ -71,27 +71,22 @@
unless Hash.respond_to?(:ruby2_keywords_hash?) && Hash.respond_to?(:ruby2_keywords_hash)
using Module.new {
refine Hash do
class << Hash
- if RUBY_VERSION >= "2.7"
- def ruby2_keywords_hash?(hash)
- !new(*[hash]).default.equal?(hash)
- end
- else
- def ruby2_keywords_hash?(hash)
- false
- end
+ def ruby2_keywords_hash?(hash)
+ !new(*[hash]).default.equal?(hash)
end
def ruby2_keywords_hash(hash)
_ruby2_keywords_hash(**hash)
end
- private def _ruby2_keywords_hash(*args)
- args.last
- end
- ruby2_keywords(:_ruby2_keywords_hash) if respond_to?(:ruby2_keywords, true)
+ private
+ def _ruby2_keywords_hash(*args)
+ args.last
+ end
+ ruby2_keywords(:_ruby2_keywords_hash)
end
end
}
end