Module: TinyConveyor

Defined in:
lib/tiny_conveyor.rb,
lib/tiny_conveyor/belt.rb,
lib/tiny_conveyor/parcel.rb

Overview

main file for Tiny Conveyor gem

Defined Under Namespace

Classes: Belt, Parcel

Constant Summary collapse

VERSION =
'0.0.1'

Class Method Summary collapse

Class Method Details

.add_parcel(name, description, action) ⇒ Array<Parcel>

Returns pending parcels.

Parameters:

  • name (string)

    name of the task

  • description (string)

    small description of the task

  • action (Proc)

    action to run in separate thread

Returns:

  • (Array<Parcel>)

    pending parcels



20
21
22
# File 'lib/tiny_conveyor.rb', line 20

def add_parcel(name, description, action)
  belt.add_parcel(name, description, action)
end

.beltBelt

Returns:



45
46
47
# File 'lib/tiny_conveyor.rb', line 45

def belt
  @belt ||= Belt.new
end

.newBelt

Returns newly created belt.

Returns:

  • (Belt)

    newly created belt



12
13
14
# File 'lib/tiny_conveyor.rb', line 12

def new
  belt
end

.parcelsArray<Parcel>

Returns pending parcels.

Returns:

  • (Array<Parcel>)

    pending parcels



40
41
42
# File 'lib/tiny_conveyor.rb', line 40

def parcels
  belt.parcels
end

.remove_parcel(uuid) ⇒ Array<Parcel>

Returns pending parcels.

Parameters:

  • uuid (string)

    uuid of the parcel to remove

Returns:

  • (Array<Parcel>)

    pending parcels



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

def remove_parcel(uuid)
  belt.remove_parcel_by_uuid(uuid)
end

.running?boolean

Returns true if the belt is running, false otherwhise.

Returns:

  • (boolean)

    true if the belt is running, false otherwhise



35
36
37
# File 'lib/tiny_conveyor.rb', line 35

def running?
  belt.running?
end

.start_beltObject



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

def start_belt
  belt.start_belt
end