Sha256: c5f7c0fee6f29dbe056eb3fc6e1f62f4334234bc0f2f0fcf8d8ba8aa12079327
Contents?: true
Size: 1.47 KB
Versions: 3
Compression:
Stored size: 1.47 KB
Contents
require 'multi_json' # OkJson won't work because it doesn't serialize symbols # in the same way yajl and json do. if MultiJson.respond_to?(:adapter) raise "Please install the yajl-ruby or json gem" if MultiJson.adapter.to_s == 'MultiJson::Adapters::OkJson' elsif MultiJson.respond_to?(:engine) raise "Please install the yajl-ruby or json gem" if MultiJson.engine.to_s == 'MultiJson::Engines::OkJson' end module ResqueAdmin # Methods used by various classes in ResqueAdmin. module Helpers class DecodeException < StandardError; end # Direct access to the Redis instance. def redis # No infinite recursions, please. # Some external libraries depend on ResqueAdmin::Helpers being mixed into # ResqueAdmin, but this method causes recursions. If we have a super method, # assume it is canonical. (see #1150) return super if defined?(super) ResqueAdmin.redis end # Given a Ruby object, returns a string suitable for storage in a # queue. def encode(object) ResqueAdmin.encode(object) end # Given a string, returns a Ruby object. def decode(object) ResqueAdmin.decode(object) end # Given a word with dashes, returns a camel cased version of it. def classify(dashed_word) ResqueAdmin.classify(dashed_word) end # Tries to find a constant with the name specified in the argument string def constantize(camel_cased_word) ResqueAdmin.constantize(camel_cased_word) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
resque_admin-1.0.5 | lib/resque_admin/helpers.rb |
resque_admin-0.2.0 | lib/resque_admin/helpers.rb |
resque_admin-2.4.4 | lib/resque_admin/helpers.rb |