Module: Fasten::Support::State
Instance Attribute Summary collapse
-
#dif ⇒ Object
Returns the value of attribute dif.
-
#error ⇒ Object
Returns the value of attribute error.
-
#fin ⇒ Object
Returns the value of attribute fin.
-
#ini ⇒ Object
Returns the value of attribute ini.
-
#runner ⇒ Object
Returns the value of attribute runner.
- #state ⇒ Object
Instance Method Summary collapse
- #deps ⇒ Object
- #deps_str ⇒ Object
- #deps_str_runner ⇒ Object
- #deps_str_task ⇒ Object
- #idle? ⇒ Boolean
- #last_avg ⇒ Object
- #last_err ⇒ Object
- #last_stat ⇒ Object
- #paused? ⇒ Boolean
- #pausing? ⇒ Boolean
- #quitting? ⇒ Boolean
- #running? ⇒ Boolean
Instance Attribute Details
#dif ⇒ Object
Returns the value of attribute dif.
6 7 8 |
# File 'lib/fasten/support/state.rb', line 6 def dif @dif end |
#error ⇒ Object
Returns the value of attribute error.
6 7 8 |
# File 'lib/fasten/support/state.rb', line 6 def error @error end |
#fin ⇒ Object
Returns the value of attribute fin.
6 7 8 |
# File 'lib/fasten/support/state.rb', line 6 def fin @fin end |
#ini ⇒ Object
Returns the value of attribute ini.
6 7 8 |
# File 'lib/fasten/support/state.rb', line 6 def ini @ini end |
#runner ⇒ Object
Returns the value of attribute runner.
6 7 8 |
# File 'lib/fasten/support/state.rb', line 6 def runner @runner end |
#state ⇒ Object
9 10 11 |
# File 'lib/fasten/support/state.rb', line 9 def state @state || :IDLE end |
Instance Method Details
#deps ⇒ Object
49 50 51 52 53 54 55 |
# 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 ⇒ Object
57 58 59 60 61 62 63 |
# 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 ⇒ Object
75 76 77 78 79 |
# 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 ⇒ Object
65 66 67 68 69 70 71 72 73 |
# 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? ⇒ Boolean
17 18 19 |
# File 'lib/fasten/support/state.rb', line 17 def idle? state == :IDLE end |
#last_avg ⇒ Object
41 42 43 |
# File 'lib/fasten/support/state.rb', line 41 def last_avg @last_avg ||= last_stat['avg'] end |
#last_err ⇒ Object
45 46 47 |
# File 'lib/fasten/support/state.rb', line 45 def last_err @last_err ||= last_stat['err'] end |
#last_stat ⇒ Object
33 34 35 36 37 38 39 |
# 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? ⇒ Boolean
25 26 27 |
# File 'lib/fasten/support/state.rb', line 25 def paused? state == :PAUSED end |
#pausing? ⇒ Boolean
21 22 23 |
# File 'lib/fasten/support/state.rb', line 21 def pausing? state == :PAUSING end |
#quitting? ⇒ Boolean
29 30 31 |
# File 'lib/fasten/support/state.rb', line 29 def quitting? state == :QUITTING end |
#running? ⇒ Boolean
13 14 15 |
# File 'lib/fasten/support/state.rb', line 13 def running? state == :RUNNING end |