Class: Wayfarer::Task

Inherits:
Object
  • Object
show all
Includes:
Stringify
Defined in:
lib/wayfarer/task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Stringify

included

Constructor Details

#initialize(url, batch) ⇒ Task

Returns a new instance of Task.



16
17
18
19
20
# File 'lib/wayfarer/task.rb', line 16

def initialize(url, batch)
  @url = url
  @batch = batch
  @metadata = OpenStruct.new
end

Instance Attribute Details

#batchObject (readonly)

Returns the value of attribute batch.



7
8
9
# File 'lib/wayfarer/task.rb', line 7

def batch
  @batch
end

#jobObject

Returns the value of attribute job.



11
12
13
# File 'lib/wayfarer/task.rb', line 11

def job
  @job
end

#metadataObject (readonly)

Returns the value of attribute metadata.



7
8
9
# File 'lib/wayfarer/task.rb', line 7

def 
  @metadata
end

#urlObject (readonly)

Returns the value of attribute url.



7
8
9
# File 'lib/wayfarer/task.rb', line 7

def url
  @url
end

Instance Method Details

#==(other) ⇒ Object



22
23
24
# File 'lib/wayfarer/task.rb', line 22

def ==(other)
  [url, batch] == [other.url, other.batch]
end

#barrierObject



26
27
28
# File 'lib/wayfarer/task.rb', line 26

def barrier
  @barrier ||= Wayfarer::Redis::Barrier.new(batch)
end

#counterObject



30
31
32
# File 'lib/wayfarer/task.rb', line 30

def counter
  @counter ||= Wayfarer::Redis::Counter.new(batch)
end