Module: AnsiEscape::StringClass
- Included in:
- String
- Defined in:
- lib/ansi_escape/string_class.rb
Overview
Extends String class
Constant Summary collapse
- @@modes =
{ :default => 0, :bold => 1, :italic => 3, :underline => 4, :blink => 5, :invert => 7, :hide => 8, :strike => 9, }
- @@fonts =
{ :default => 0, :font1 => 1, :font2 => 2, :font3 => 3, :font4 => 4, :font5 => 5, :font6 => 6, :font7 => 7, :font8 => 8, :font9 => 9, }
- @@colors =
{ :black => 0, :red => 1, :green => 2, :yellow => 3, :blue => 4, :magenta => 5, :cyan => 6, :white => 7, :default => 9, }
Instance Method Summary collapse
- #colors ⇒ Object
- #fonts ⇒ Object
- #modes ⇒ Object
-
#symbol_to_code(symbol_or_code, hash) ⇒ Object
lookup symbol in hash and convert to code.
Instance Method Details
#colors ⇒ Object
53 54 55 |
# File 'lib/ansi_escape/string_class.rb', line 53 def colors @@colors end |
#fonts ⇒ Object
49 50 51 |
# File 'lib/ansi_escape/string_class.rb', line 49 def fonts @@fonts end |
#modes ⇒ Object
45 46 47 |
# File 'lib/ansi_escape/string_class.rb', line 45 def modes @@modes end |
#symbol_to_code(symbol_or_code, hash) ⇒ Object
lookup symbol in hash and convert to code
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/ansi_escape/string_class.rb', line 58 def symbol_to_code(symbol_or_code, hash) is_sym = (symbol_or_code.is_a? Symbol) code = ( is_sym ) ? hash[symbol_or_code] : symbol_or_code if (code.nil? || !hash.value?(code)) then raise ArgumentError, get_symbol_to_code_error(symbol_or_code, hash) end return code end |