Module: Kicker::Utils
Overview
:nodoc:
Instance Attribute Summary collapse
-
#should_clear_screen ⇒ Object
(also: #should_clear_screen?)
Returns the value of attribute should_clear_screen.
Instance Method Summary collapse
- #clear_console! ⇒ Object
- #execute(command) ⇒ Object
- #last_command ⇒ Object
- #last_command_status ⇒ Object
- #last_command_succeeded? ⇒ Boolean
- #log(message) ⇒ Object
- #perform_work(command) {|status| ... } ⇒ Object
Instance Attribute Details
#should_clear_screen ⇒ Object Also known as: should_clear_screen?
Returns the value of attribute should_clear_screen.
13 14 15 |
# File 'lib/kicker/utils.rb', line 13 def should_clear_screen @should_clear_screen end |
Instance Method Details
#clear_console! ⇒ Object
53 54 55 |
# File 'lib/kicker/utils.rb', line 53 def clear_console! puts(CLEAR) if Kicker.clear_console? end |
#execute(command) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/kicker/utils.rb', line 25 def execute(command) perform_work(command) do |status| _execute(status) yield status if block_given? end end |
#last_command ⇒ Object
32 33 34 |
# File 'lib/kicker/utils.rb', line 32 def last_command @last_command end |
#last_command_status ⇒ Object
49 50 51 |
# File 'lib/kicker/utils.rb', line 49 def last_command_status $?.exitstatus end |
#last_command_succeeded? ⇒ Boolean
45 46 47 |
# File 'lib/kicker/utils.rb', line 45 def last_command_succeeded? $?.success? end |
#log(message) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/kicker/utils.rb', line 36 def log() if Kicker.quiet puts else now = Time.now puts "#{now.strftime('%H:%M:%S')}.#{now.usec.to_s[0,2]} | #{message}" end end |
#perform_work(command) {|status| ... } ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/kicker/utils.rb', line 16 def perform_work(command) @last_command = command status = Status.new(command, 0, '') will_execute_command(status) yield status did_execute_command(status) status end |