Class: Rake::Task

Inherits:
Object show all
Includes:
StatePatch
Defined in:
lib/ruby_smart/support/core_ext/rake/task.rb

Defined Under Namespace

Modules: StatePatch

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#stateObject (readonly)

Returns the value of attribute state.



18
19
20
# File 'lib/ruby_smart/support/core_ext/rake/task.rb', line 18

def state
  @state
end

Instance Method Details

#append(&block) ⇒ Rake::Task

append the given block to the 'actions'-array this method is chainable and returns self

Parameters:

  • block (Proc)

Returns:



43
44
45
46
# File 'lib/ruby_smart/support/core_ext/rake/task.rb', line 43

def append(&block)
  @actions << block
  self
end

#execute(*args) ⇒ Object Originally defined in module StatePatch

overwriting the execute method to track the current state

#invoked?Boolean

returns true, if this task was invoked

Returns:

  • (Boolean)


22
23
24
# File 'lib/ruby_smart/support/core_ext/rake/task.rb', line 22

def invoked?
  !!@already_invoked
end

#performed?Boolean

returns true, if this task performed (executed)

Returns:

  • (Boolean)


28
29
30
# File 'lib/ruby_smart/support/core_ext/rake/task.rb', line 28

def performed?
  @state == :done
end

#prepend(&block) ⇒ Rake::Task

prepends the given block to the 'actions'-array this method is chainable and returns self

Parameters:

  • block (Proc)

Returns:



53
54
55
56
# File 'lib/ruby_smart/support/core_ext/rake/task.rb', line 53

def prepend(&block)
  @actions.unshift(block)
  self
end

#running?Boolean

returns true, if this task is currently running

Returns:

  • (Boolean)


34
35
36
# File 'lib/ruby_smart/support/core_ext/rake/task.rb', line 34

def running?
  @state == :running
end