joris / ruby-console

A straightforward console writer for Ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A little, straightforward console tool for (Rake) logging purposes.

Usage:

output something to the console (block is optional):

console.say("Info for terminal output") { sleep 5 }

Keep track of the time:

console.say_with_time("Info for terminal output") { sleep 5 }
=> this will output "5.0 seconds" after the log itself.

This command    => writes + counts:
console.dot     =>  .
console.skip    =>  >
console.failure =>  x
console.error   =>  x

It will count the dots with their types

Example:

console.say_with_time("FIRST level") do
  console.say("SECOND level") do
    console.say_with_time("THIRD level") do
      420.times{ console.dot }
    end
    # console.dot
    console.puts("second")
  end
  console.dot
  console.dot
  console.puts("first")
  console.dot
  console.dot
end

Will output:

FIRST level
  SECOND level
    THIRD level
      .................................................................................................... 100
      .................................................................................................... 200
      .................................................................................................... 300
      .................................................................................................... 400
      ....................
     -> 0.00 seconds
    second
  ..first
  ..
 -> 0.01 seconds

About

A straightforward console writer for Ruby


Languages

Language:Ruby 100.0%