lib/sidekiq.rb in sidekiq-1.1.2 vs lib/sidekiq.rb in sidekiq-1.1.3

- old
+ new

@@ -80,6 +80,24 @@ @server_chain ||= Processor.default_middleware yield @server_chain if block_given? @server_chain end + def self.load_json(string) + # Can't reliably detect whether MultiJson responds to load, since it's + # a reserved word. Use adapter as a proxy for new features. + if MultiJson.respond_to?(:adapter) + MultiJson.load(string) + else + MultiJson.decode(string) + end + end + + def self.dump_json(object) + if MultiJson.respond_to?(:dump) + MultiJson.dump(object) + else + MultiJson.encode(object) + end + end + end