Class: Fixman::Task

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, condition, command, cleanup) ⇒ Task

Returns a new instance of Task.



5
6
7
8
9
10
# File 'lib/fixman/task.rb', line 5

def initialize(name, condition, command, cleanup)
  @name = name
  @condition = condition
  @command = command
  @cleanup = cleanup
end

Instance Attribute Details

#conditionObject (readonly)

Returns the value of attribute condition.



3
4
5
# File 'lib/fixman/task.rb', line 3

def condition
  @condition
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/fixman/task.rb', line 3

def name
  @name
end

Instance Method Details

#run(target) ⇒ Object



12
13
14
15
16
17
# File 'lib/fixman/task.rb', line 12

def run target
  success = @command.call(target)
  @cleanup.call(target)

  success
end