Class: Kitchen::Terraform::CommandFlag::Color

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/terraform/command_flag/color.rb

Overview

Color is the class of objects which control coloured output.

Instance Method Summary collapse

Constructor Details

#initialize(enabled:) ⇒ Kitchen::Terraform::CommandFlag::Color

#initialize prepares a new instance of the class.

Parameters:

  • enabled (Boolean)

    a toggle to enable or disable color.



26
27
28
# File 'lib/kitchen/terraform/command_flag/color.rb', line 26

def initialize(enabled:)
  self.enabled = enabled
end

Instance Method Details

#to_sString

Returns the color flag.

Returns:

  • (String)

    the color flag.



31
32
33
34
35
36
37
# File 'lib/kitchen/terraform/command_flag/color.rb', line 31

def to_s
  if enabled
    ""
  else
    "-no-color"
  end
end