Module: Ruboto::Util::LogAction

Included in:
API
Defined in:
lib/ruboto/util/log_action.rb

Instance Method Summary collapse

Instance Method Details

#log_action(initial_text, final_text = "Done.", &block) ⇒ Object

log_action: put text to stdout around the execution of a block


9
10
11
12
13
14
15
16
17
# File 'lib/ruboto/util/log_action.rb', line 9

def log_action(initial_text, final_text="Done.", &block)
  $stdout.sync = true

  print initial_text, "..."
  result = yield
  puts final_text
  
  result
end