Class: Fudge::Formatters::Simple
- Inherits:
-
Object
- Object
- Fudge::Formatters::Simple
- Defined in:
- lib/fudge/formatters/simple.rb
Overview
Simple coloured STDOUT/STDERR formatting
Defined Under Namespace
Classes: Writer
Constant Summary collapse
- CODE =
ASCII Color Codes
{ :off => 0, :bright => 1, :red => 31, :green => 32, :yellow => 33, :cyan => 36 }
Instance Attribute Summary collapse
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
-
#error(message) ⇒ Object
Report Error Message.
-
#info(message) ⇒ Object
Report Information Message.
-
#initialize(stdout = $stdout) ⇒ Simple
constructor
A new instance of Simple.
-
#normal(message) ⇒ Object
Normal information.
-
#notice(message) ⇒ Object
Report Notice Message.
-
#putc(c) ⇒ Object
Output a character.
-
#puts(message) ⇒ Object
Directly output.
-
#success(message) ⇒ Object
Report Success Message.
-
#write {|w| ... } ⇒ Object
Yields a writer which can chain message types to output.
Constructor Details
#initialize(stdout = $stdout) ⇒ Simple
Returns a new instance of Simple.
46 47 48 |
# File 'lib/fudge/formatters/simple.rb', line 46 def initialize(stdout=$stdout) @stdout = stdout end |
Instance Attribute Details
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
44 45 46 |
# File 'lib/fudge/formatters/simple.rb', line 44 def stdout @stdout end |
Instance Method Details
#error(message) ⇒ Object
Report Error Message
51 52 53 |
# File 'lib/fudge/formatters/simple.rb', line 51 def error() ascii :red, end |
#info(message) ⇒ Object
Report Information Message
61 62 63 |
# File 'lib/fudge/formatters/simple.rb', line 61 def info() ascii :cyan, end |
#normal(message) ⇒ Object
Normal information
71 72 73 |
# File 'lib/fudge/formatters/simple.rb', line 71 def normal() end |
#notice(message) ⇒ Object
Report Notice Message
66 67 68 |
# File 'lib/fudge/formatters/simple.rb', line 66 def notice() ascii :yellow, end |
#putc(c) ⇒ Object
Output a character
88 89 90 |
# File 'lib/fudge/formatters/simple.rb', line 88 def putc(c) stdout.putc(c) end |
#puts(message) ⇒ Object
Directly output
76 77 78 |
# File 'lib/fudge/formatters/simple.rb', line 76 def puts() stdout.puts end |
#success(message) ⇒ Object
Report Success Message
56 57 58 |
# File 'lib/fudge/formatters/simple.rb', line 56 def success() ascii :bright, :green, end |