Class: Megingiard::TextColorSequence

Inherits:
Object
  • Object
show all
Defined in:
lib/megingiard/text_color_sequence.rb

Overview

ANSI Escape Sequence for a Text Color

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ TextColorSequence

Returns a new instance of TextColorSequence.



8
9
10
11
# File 'lib/megingiard/text_color_sequence.rb', line 8

def initialize(name)
  color_code = ANSI_COLORS.fetch(name)
  @escape_sequence = AnsiEscapeSequence.new(color_code + 30)
end

Instance Method Details

#to_sObject



13
14
15
# File 'lib/megingiard/text_color_sequence.rb', line 13

def to_s
  @escape_sequence.to_s
end