Class: Choria::Colt::CLI::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/choria/colt/cli/formatter.rb

Defined Under Namespace

Modules: FormattedResult, Result

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#pastelObject (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