Module: Ruwi::Dom::Scheduler

Defined in:
lib/ruwi/runtime/dom/scheduler.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.jobsArray

Returns Array of jobs to be processed.

Returns:

  • (Array)

    Array of jobs to be processed



9
10
11
# File 'lib/ruwi/runtime/dom/scheduler.rb', line 9

def jobs
  @jobs
end

.scheduledBoolean

Returns Flag indicating if a job processing is scheduled.

Returns:

  • (Boolean)

    Flag indicating if a job processing is scheduled



6
7
8
# File 'lib/ruwi/runtime/dom/scheduler.rb', line 6

def scheduled
  @scheduled
end

Class Method Details

.enqueue_job(job) ⇒ void

This method returns an undefined value.

Enqueues a job to be processed

Parameters:

  • job (Proc)

    The job to be executed



20
21
22
23
24
# File 'lib/ruwi/runtime/dom/scheduler.rb', line 20

def enqueue_job(job)
  initialize_scheduler if @jobs.nil?
  @jobs.push(job)
  schedule_update
end

.initialize_schedulerObject

Initialize class variables



12
13
14
15
# File 'lib/ruwi/runtime/dom/scheduler.rb', line 12

def initialize_scheduler
  @scheduled = false
  @jobs = []
end