Class: Kamaze::Project::Tools::Console::Output::Buffer
- Defined in:
- lib/kamaze/project/tools/console/output/buffer.rb,
lib/kamaze/project/tools/console/output/buffer.rb
Overview
Describe a buffer
Instance Attribute Summary collapse
-
#content ⇒ String
readonly
Get content.
- #output ⇒ Kamaze::Project::Tools::Console::Output readonly protected
Instance Method Summary collapse
-
#decorate(str) ⇒ String
protected
Decorate given string depending
output
is a tty. -
#initialize(output, content) ⇒ Buffer
constructor
A new instance of Buffer.
- #to_s ⇒ String
Constructor Details
#initialize(output, content) ⇒ Buffer
Returns a new instance of Buffer.
26 27 28 29 |
# File 'lib/kamaze/project/tools/console/output/buffer.rb', line 26 def initialize(output, content) @output = output @content = content end |
Instance Attribute Details
#content ⇒ String (readonly)
Get content
22 23 24 |
# File 'lib/kamaze/project/tools/console/output/buffer.rb', line 22 def content @content end |
#output ⇒ Kamaze::Project::Tools::Console::Output (readonly, protected)
39 40 41 |
# File 'lib/kamaze/project/tools/console/output/buffer.rb', line 39 def output @output end |
Instance Method Details
#decorate(str) ⇒ String (protected)
Decorate given string depending output
is a tty
45 46 47 |
# File 'lib/kamaze/project/tools/console/output/buffer.rb', line 45 def decorate(str) CLI::UI.fmt(str.to_s, enable_color: output.tty?) end |
#to_s ⇒ String
32 33 34 |
# File 'lib/kamaze/project/tools/console/output/buffer.rb', line 32 def to_s self.decorate(content) end |