Class: Hexdump::Theme::ANSI Private
- Inherits:
-
Object
- Object
- Hexdump::Theme::ANSI
- Defined in:
- lib/hexdump/theme/ansi.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.
Represents an ANSI control sequence.
Constant Summary collapse
- RESET =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
ANSI reset control sequence
"\e[0m"
- PARAMETERS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ reset: RESET, bold: "\e[1m", faint: "\e[2m", italic: "\e[3m", underline: "\e[4m", invert: "\e[7m", strike: "\e[9m", black: "\e[30m", red: "\e[31m", green: "\e[32m", yellow: "\e[33m", blue: "\e[34m", magenta: "\e[35m", cyan: "\e[36m", white: "\e[37m", on_black: "\e[40m", on_red: "\e[41m", on_green: "\e[42m", on_yellow: "\e[43m", on_blue: "\e[44m", on_magenta: "\e[45m", on_cyan: "\e[46m", on_white: "\e[47m" }
Instance Attribute Summary collapse
-
#parameters ⇒ Symbol+
readonly
private
The style name(s).
-
#string ⇒ String
readonly
private
The ANSI string.
Instance Method Summary collapse
-
#initialize(parameters) ⇒ ANSI
constructor
private
Initializes an ANSI control sequence.
-
#to_s ⇒ String
(also: #to_str)
private
Returns the ANSI string.
Constructor Details
#initialize(parameters) ⇒ ANSI
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes an ANSI control sequence.
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/hexdump/theme/ansi.rb', line 58 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 |
Instance Attribute Details
#parameters ⇒ Symbol+ (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The style name(s).
45 46 47 |
# File 'lib/hexdump/theme/ansi.rb', line 45 def parameters @parameters end |
#string ⇒ String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The ANSI string.
50 51 52 |
# File 'lib/hexdump/theme/ansi.rb', line 50 def string @string end |
Instance Method Details
#to_s ⇒ String Also known as: to_str
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the ANSI string.
75 76 77 |
# File 'lib/hexdump/theme/ansi.rb', line 75 def to_s @string end |