Class: ResquePoll::Job

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Naming
Defined in:
app/models/resque_poll/job.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, params) ⇒ Job

Returns a new instance of Job.



6
7
8
9
# File 'app/models/resque_poll/job.rb', line 6

def initialize(klass, params)
  @klass  = klass
  @params = params
end

Instance Attribute Details

#job_idObject (readonly)

Returns the value of attribute job_id.



4
5
6
# File 'app/models/resque_poll/job.rb', line 4

def job_id
  @job_id
end

#klassObject (readonly)

Returns the value of attribute klass.



4
5
6
# File 'app/models/resque_poll/job.rb', line 4

def klass
  @klass
end

#paramsObject (readonly)

Returns the value of attribute params.



4
5
6
# File 'app/models/resque_poll/job.rb', line 4

def params
  @params
end

Class Method Details

.create(*args) ⇒ Object



11
12
13
# File 'app/models/resque_poll/job.rb', line 11

def self.create(*args)
  new(*args).create
end

Instance Method Details

#as_json(options = {}) ⇒ Object



20
21
22
# File 'app/models/resque_poll/job.rb', line 20

def as_json(options = {})
  {poll: job_path}
end

#createObject



15
16
17
18
# File 'app/models/resque_poll/job.rb', line 15

def create
  @job_id = klass.create(params)
  self
end