Class: Rumor::Async::Resque::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/rumor/async/resque.rb

Class Method Summary collapse

Class Method Details

.hash_to_symbols(hash) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/rumor/async/resque.rb', line 26

def self.hash_to_symbols hash
  symbol_hash = {}
  hash.each do |k,v|
    symbol_hash[k.to_sym] = v
  end
  symbol_hash
end

.perform(rumor_hash) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/rumor/async/resque.rb', line 15

def self.perform rumor_hash
  hash = hash_to_symbols rumor_hash
  hash[:mentions] = hash_to_symbols hash[:mentions]
  hash[:tags].map! &:to_sym
  hash[:time] = Time.new hash[:time]
  # Deserialize the rumor.
  rumor = Rumor.from_h hash
  # Spread again.
  ::Rumor.spread rumor
end