Class: Bookwatch::Streams::ColorizedStream
- Inherits:
-
Object
- Object
- Bookwatch::Streams::ColorizedStream
- Defined in:
- lib/bookwatch/streams/colorized_stream.rb
Instance Method Summary collapse
- #<<(text) ⇒ Object
-
#initialize(color, stream) ⇒ ColorizedStream
constructor
A new instance of ColorizedStream.
- #puts(line) ⇒ Object
Constructor Details
#initialize(color, stream) ⇒ ColorizedStream
Returns a new instance of ColorizedStream.
6 7 8 9 10 |
# File 'lib/bookwatch/streams/colorized_stream.rb', line 6 def initialize(color, stream) @color = color @stream = stream @colorizer = Colorizer.new end |
Instance Method Details
#<<(text) ⇒ Object
16 17 18 |
# File 'lib/bookwatch/streams/colorized_stream.rb', line 16 def <<(text) stream << colorizer.colorize(text, color) end |
#puts(line) ⇒ Object
12 13 14 |
# File 'lib/bookwatch/streams/colorized_stream.rb', line 12 def puts(line) stream.puts(colorizer.colorize(line, color)) end |