Module: Coque::Runnable
Instance Method Summary collapse
- #log_end(seconds) ⇒ Object
- #log_start ⇒ Object
- #run ⇒ Object
- #run! ⇒ Object
- #success? ⇒ Boolean
- #to_a ⇒ Object
Instance Method Details
#log_end(seconds) ⇒ Object
26 27 28 29 30 |
# File 'lib/coque/runnable.rb', line 26 def log_end(seconds) if Coque.logger Coque.logger.info("Coque Command: #{self.to_s} finished in #{seconds} seconds.") end end |
#log_start ⇒ Object
32 33 34 35 36 |
# File 'lib/coque/runnable.rb', line 32 def log_start if Coque.logger Coque.logger.info("Executing Coque Command: #{self.to_s}") end end |
#run ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/coque/runnable.rb', line 17 def run log_start start_time = Time.now result = get_result end_time = Time.now log_end(end_time - start_time) result end |
#run! ⇒ Object
11 12 13 14 15 |
# File 'lib/coque/runnable.rb', line 11 def run! if !success? raise "Coque Command Failed: #{self}" end end |
#success? ⇒ Boolean
7 8 9 |
# File 'lib/coque/runnable.rb', line 7 def success? run.success? end |
#to_a ⇒ Object
3 4 5 |
# File 'lib/coque/runnable.rb', line 3 def to_a run.to_a end |