Class: Choria::Colt::CLI::Formatter
- Inherits:
-
Object
- Object
- Choria::Colt::CLI::Formatter
- Defined in:
- lib/choria/colt/cli/formatter.rb
Defined Under Namespace
Modules: FormattedResult, Result
Instance Attribute Summary collapse
-
#pastel ⇒ Object
readonly
Returns the value of attribute pastel.
Instance Method Summary collapse
- #format(result) ⇒ Object
-
#initialize(colored:) ⇒ Formatter
constructor
A new instance of Formatter.
Constructor Details
#initialize(colored:) ⇒ Formatter
Returns a new instance of Formatter.
152 153 154 155 |
# File 'lib/choria/colt/cli/formatter.rb', line 152 def initialize(colored:) @pastel = Pastel.new(enabled: colored) pastel.alias_color(:host, :cyan) end |
Instance Attribute Details
#pastel ⇒ Object (readonly)
Returns the value of attribute pastel.
150 151 152 |
# File 'lib/choria/colt/cli/formatter.rb', line 150 def pastel @pastel end |
Instance Method Details
#format(result) ⇒ Object
157 158 159 160 161 162 |
# File 'lib/choria/colt/cli/formatter.rb', line 157 def format(result) result.extend Formatter::Result result.extend Formatter::FormattedResult result.pastel = pastel result end |