Class: CouchRest::ExtendedDocument

Inherits:
Object
  • Object
show all
Defined in:
lib/delayed/backend/couch_rest.rb

Overview

extent couchrest to handle delayed_job serialization.

Direct Known Subclasses

Delayed::Backend::CouchRest::Job

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find(id) ⇒ Object



12
13
14
# File 'lib/delayed/backend/couch_rest.rb', line 12

def self.find(id)
  get id
end

.yaml_new(klass, tag, val) ⇒ Object



15
16
17
# File 'lib/delayed/backend/couch_rest.rb', line 15

def self.yaml_new(klass, tag, val)
  klass.get(val['_id'])
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/delayed/backend/couch_rest.rb', line 18

def ==(other)
  if other.is_a? ::CouchRest::ExtendedDocument
    self['_id'] == other['_id']
  else
    super
  end
end

#reloadObject



8
9
10
11
# File 'lib/delayed/backend/couch_rest.rb', line 8

def reload
  job = self.class.get self['_id']
  job.each {|k,v| self[k] = v}
end