Sha256: 8ac0dc087c79de54aa29772caaa72e33ade031f9b7ec0fb48e8e9b639346af9f
Contents?: true
Size: 1.43 KB
Versions: 3
Compression:
Stored size: 1.43 KB
Contents
require 'digest' module Fasten module Support module State attr_accessor :error, :ini, :fin, :dif, :runner attr_writer :state def state @state || :IDLE end def running? state == :RUNNING end def idle? state == :IDLE end def pausing? state == :PAUSING end def paused? state == :PAUSED end def quitting? state == :QUITTING end def last_stat return @last_stat if defined? @last_stat return {} unless @runner @last_stat = runner.stats_last(self) end def last_avg @last_avg ||= last_stat['avg'] end def last_err @last_err ||= last_stat['err'] end def deps return @deps if defined? @deps str = deps_str @deps = str && Digest::SHA1.hexdigest(str) end def deps_str if is_a? Fasten::Task deps_str_task elsif is_a? Fasten::Runner deps_str_runner end end 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 def deps_str_runner tasks.sort_by(&:name).map do |task| [task.name, task.deps_str].compact.join(': ') end.join("\n") end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fasten-0.18.0 | lib/fasten/support/state.rb |
fasten-0.16.0 | lib/fasten/support/state.rb |
fasten-0.14.4 | lib/fasten/support/state.rb |