Class: MapRedus::Helper

Inherits:
Object
  • Object
show all
Extended by:
Resque::Helpers
Defined in:
lib/mapredus.rb

Class Method Summary collapse

Class Method Details

.class_get(string) ⇒ Object

Returns the classname of the namespaced class.

The full name of the class.

Examples

Support::class_get( Super::Long::Namespace::ClassName )
# => 'ClassName'

Returns the class name.



91
92
93
# File 'lib/mapredus.rb', line 91

def self.class_get(string)
  constantize(string)
end

.key_hash(key) ⇒ Object

Defines a hash by taking the absolute value of ruby’s string hash to rid the dashes since redis keys should not contain any.

key - The key to be hashed.

Examples

Support::key_hash( key )
# => '8dd8hflf8dhod8doh9hef'

Returns the hash.



77
78
79
# File 'lib/mapredus.rb', line 77

def self.key_hash( key )
  key.to_s.hash.abs.to_s(16)
end