class Hexdump::Theme::ANSI

Represents an ANSI control sequence.

@api private

@since 1.0.0

Constants

PARAMETERS
RESET

ANSI reset control sequence

Attributes

parameters[R]

The style name(s).

@return [Symbol, Array<Symbol>] style

string[R]

The ANSI string.

@return [String]

Public Class Methods

new(parameters) click to toggle source

Initializes an ANSI control sequence.

@param [Symbol, Array<Symbol>] style

# File lib/hexdump/theme/ansi.rb, line 57
def initialize(parameters)
  @parameters = parameters

  @string = String.new

  Array(parameters).each do |name|
    @string << PARAMETERS.fetch(name) do
      raise(ArgumentError,"unknown ANSI parameter: #{name}")
    end
  end
end

Public Instance Methods

to_s() click to toggle source

Returns the ANSI string.

@return [String]

# File lib/hexdump/theme/ansi.rb, line 74
def to_s
  @string
end
Also aliased as: to_str
to_str()
Alias for: to_s