Module: TimeLine

Defined in:
lib/arbi/timeline.rb

Defined Under Namespace

Classes: Job

Class Method Summary collapse

Class Method Details

.register(job) ⇒ Object

Raises:

  • (ArgumentError)


64
65
66
67
68
69
# File 'lib/arbi/timeline.rb', line 64

def register(job)
  raise ArgumentError, "job must be a TimeLine::Job" unless job.is_a?(TimeLine::Job)
  @@jobs ||= []
  job.run if running?
  @@jobs << job
end

.runObject



71
72
73
74
75
76
77
78
# File 'lib/arbi/timeline.rb', line 71

def run
  @@jobs ||= []
  @@jobs.each {|job|
    job.run
  }
  @running = true
  self
end

.running?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/arbi/timeline.rb', line 60

def running?
  @running ||= false
end