Class: TTY::Markdown::Color Private

Inherits:
Object
  • Object
show all
Defined in:
lib/tty/markdown/color.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Responsible for storing the color configuration

Instance Method Summary collapse

Constructor Details

#initialize(color) ⇒ Color

Create a TTY::Markdown::Color instance

Examples:

color = TTY::Markdown::Color.new(:always)

Parameters:

  • color (String, Symbol)

    the color configuration

Raises:



55
56
57
# File 'lib/tty/markdown/color.rb', line 55

def initialize(color)
  @color = validate(color)
end

Instance Method Details

#to_enabledBoolean?

Convert to the Pastel enabled option

Examples:

color.to_enabled

Returns:

  • (Boolean, nil)


67
68
69
70
71
72
# File 'lib/tty/markdown/color.rb', line 67

def to_enabled
  case @color.to_s
  when ALWAYS then true
  when NEVER  then false
  end
end