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_or_options) ⇒ Object
- #log(message) ⇒ Object
- #perform_work(command_or_options) {|job| ... } ⇒ Object
Instance Attribute Details
#should_clear_screen ⇒ Object Also known as: should_clear_screen?
Returns the value of attribute should_clear_screen.
7 8 9 |
# File 'lib/kicker/utils.rb', line 7 def should_clear_screen @should_clear_screen end |
Instance Method Details
#clear_console! ⇒ Object
41 42 43 |
# File 'lib/kicker/utils.rb', line 41 def clear_console! puts(CLEAR) if Kicker.clear_console? end |
#execute(command_or_options) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/kicker/utils.rb', line 25 def execute() perform_work() do |job| _execute(job) yield job if block_given? end end |
#log(message) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/kicker/utils.rb', line 32 def log() if Kicker.quiet puts else now = Time.now puts "#{now.strftime('%H:%M:%S')}.#{now.usec.to_s[0,2]} | #{}" end end |
#perform_work(command_or_options) {|job| ... } ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/kicker/utils.rb', line 10 def perform_work() if .is_a?(Hash) = elsif .is_a?(String) = { :command => } else raise ArgumentError, "Should be a string or a hash." end job = Job.new() will_execute_command(job) yield job did_execute_command(job) job end |