aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/lib/active_job/arguments.rb
diff options
context:
space:
mode:
authorAbdelkader Boudih <terminale@gmail.com>2014-08-15 10:04:06 +0000
committerAbdelkader Boudih <terminale@gmail.com>2014-08-17 23:10:28 +0000
commit3954fdf5f325719143df12860f65d778350d12ed (patch)
tree2bcc0a7daa5ad8bc6134ae858b8fc8b8a5d8b7ab /activejob/lib/active_job/arguments.rb
parentfdc7dbc5b239f44243b9a973197ca7c031bc6313 (diff)
downloadrails-3954fdf5f325719143df12860f65d778350d12ed.tar.gz
rails-3954fdf5f325719143df12860f65d778350d12ed.tar.bz2
rails-3954fdf5f325719143df12860f65d778350d12ed.zip
[ActiveJob] Convert ActiveJob::Arguments into module
Diffstat (limited to 'activejob/lib/active_job/arguments.rb')
-rw-r--r--activejob/lib/active_job/arguments.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/activejob/lib/active_job/arguments.rb b/activejob/lib/active_job/arguments.rb
index ef6a3fce1d..8486a9e918 100644
--- a/activejob/lib/active_job/arguments.rb
+++ b/activejob/lib/active_job/arguments.rb
@@ -2,19 +2,20 @@ require 'active_model/global_locator'
require 'active_model/global_identification'
module ActiveJob
- class Arguments
+ module Arguments
+ extend self
TYPE_WHITELIST = [ NilClass, Fixnum, Float, String, TrueClass, FalseClass, Bignum ]
- def self.serialize(arguments)
+ def serialize(arguments)
arguments.map { |argument| serialize_argument(argument) }
end
- def self.deserialize(arguments)
+ def deserialize(arguments)
arguments.map { |argument| deserialize_argument(argument) }
end
private
- def self.serialize_argument(argument)
+ def serialize_argument(argument)
case argument
when ActiveModel::GlobalIdentification
argument.global_id.to_s
@@ -29,7 +30,7 @@ module ActiveJob
end
end
- def self.deserialize_argument(argument)
+ def deserialize_argument(argument)
case argument
when Array
deserialize(argument)
@@ -40,7 +41,7 @@ module ActiveJob
end
end
- def self.serialize_hash_key(key)
+ def serialize_hash_key(key)
case key
when String, Symbol
key.to_s