module Fasten::Support::State

Attributes

dif[RW]
error[RW]
fin[RW]
ini[RW]
runner[RW]
state[W]

Public Instance Methods

deps() click to toggle source
# File lib/fasten/support/state.rb, line 49
def deps
  return @deps if defined? @deps

  str = deps_str

  @deps = str && Digest::SHA1.hexdigest(str)
end
deps_str() click to toggle source
# File lib/fasten/support/state.rb, line 57
def deps_str
  if is_a? Fasten::Task
    deps_str_task
  elsif is_a? Fasten::Runner
    deps_str_runner
  end
end
deps_str_runner() click to toggle source
# File lib/fasten/support/state.rb, line 75
def deps_str_runner
  tasks.sort_by(&:name).map do |task|
    [task.name, task.deps_str].compact.join(': ')
  end.join("\n")
end
deps_str_task() click to toggle source
# File lib/fasten/support/state.rb, line 65
def deps_str_task
  if after.is_a? Array
    after.sort_by do |task|
      task.is_a?(Fasten::Task) ? task.name : task
    end&.join(', ')
  else
    after
  end
end
idle?() click to toggle source
# File lib/fasten/support/state.rb, line 17
def idle?
  state == :IDLE
end
last_avg() click to toggle source
# File lib/fasten/support/state.rb, line 41
def last_avg
  @last_avg ||= last_stat['avg']
end
last_err() click to toggle source
# File lib/fasten/support/state.rb, line 45
def last_err
  @last_err ||= last_stat['err']
end
last_stat() click to toggle source
# File lib/fasten/support/state.rb, line 33
def last_stat
  return @last_stat if defined? @last_stat

  return {} unless @runner

  @last_stat = runner.stats_last(self)
end
paused?() click to toggle source
# File lib/fasten/support/state.rb, line 25
def paused?
  state == :PAUSED
end
pausing?() click to toggle source
# File lib/fasten/support/state.rb, line 21
def pausing?
  state == :PAUSING
end
quitting?() click to toggle source
# File lib/fasten/support/state.rb, line 29
def quitting?
  state == :QUITTING
end
running?() click to toggle source
# File lib/fasten/support/state.rb, line 13
def running?
  state == :RUNNING
end
state() click to toggle source
# File lib/fasten/support/state.rb, line 9
def state
  @state || :IDLE
end