Class: Utilities

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/flutter_tests/utils/utilities.rb

Instance Method Summary collapse

Constructor Details

#initializeUtilities

Returns a new instance of Utilities.



3
4
5
6
7
8
9
# File 'lib/fastlane/plugin/flutter_tests/utils/utilities.rb', line 3

def initialize
  @colors = {
    'blue' => 34,
    'green' => 32,
    'red' => 31,
  }
end

Instance Method Details

#colorize(message, color) ⇒ String

Colorize a message. If the color specified doesn’t exists, returns the default message

Parameters:

  • message (String)

    the message that has to be colorized before printing

  • color (String)

    the name of the color

Returns:

  • (String)

    the message wrapped in a new color



17
18
19
20
21
22
23
24
# File 'lib/fastlane/plugin/flutter_tests/utils/utilities.rb', line 17

def colorize(message, color)
  if @colors.has_key? color
    color_code = @colors[color]
    "\e[#{color_code}m#{message}\e[0m"
  else
    message
  end
end