Class: Fire::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/fire/task.rb

Overview

The Task class encapsulates command-line dependent rules.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}, &procedure) ⇒ Task

Returns a new instance of Task.



7
8
9
10
11
12
13
14
# File 'lib/fire/task.rb', line 7

def initialize(name, options={}, &procedure)
  @name        = name
  @description = options[:desc]
  @requisite   = options[:todo] || []
  @procedure   = procedure

  #@_reducing = nil
end

Instance Attribute Details

#descriptionObject (readonly)

Task description. This is need for a task to available via the command line.



21
22
23
# File 'lib/fire/task.rb', line 21

def description
  @description
end

#nameObject (readonly)

The tasks name.



17
18
19
# File 'lib/fire/task.rb', line 17

def name
  @name
end

#requisiteObject (readonly) Also known as: todo

Returns the value of attribute requisite.



24
25
26
# File 'lib/fire/task.rb', line 24

def requisite
  @requisite
end

Instance Method Details

#callObject (protected)



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

def call
  @procedure.call
end

#invoke(&prepare) ⇒ Object Also known as: apply

Run the task.



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

def invoke(&prepare)
  prepare.call
  call
end