Module: Vedeu::EscapeSequences::Borders
Overview
Note:
Refer to UTF-8 U+2500 to U+257F for border characters. More details can be found at:
en.wikipedia.org/wiki/Box-drawing_character
Using the ‘uXXXX’ variant produces gaps in the border, whilst the ‘xXX’ renders ‘nicely’.
Provides border/box related escape sequences.
Class Method Summary collapse
- .border_off ⇒ String
- .border_on ⇒ String
-
.characters ⇒ Hash<Symbol => String>
Provides all the semigraphic characters.
- .define_borders! ⇒ void private
- .setup! ⇒ void
Instance Method Summary collapse
- #border_off ⇒ String
- #border_on ⇒ String
-
#characters ⇒ Hash<Symbol => String>
Provides all the semigraphic characters.
- #define_borders! ⇒ void private
- #setup! ⇒ void
Class Method Details
.border_off ⇒ String
26 27 28 |
# File 'lib/vedeu/esc/borders.rb', line 26 def border_off "\e(B".freeze end |
.border_on ⇒ String
21 22 23 |
# File 'lib/vedeu/esc/borders.rb', line 21 def border_on "\e(0".freeze end |
.characters ⇒ Hash<Symbol => String>
Provides all the semigraphic characters.
# 0 1 2 3 4 5 6 7 8 9 A B C D E F 6 ┘ ┐ ┌ └ ┼7 ─ ├ ┤ ┴ ┬ │
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/vedeu/esc/borders.rb', line 37 def characters { bottom_right: "\x6A".freeze, # ┘ # \u2518 top_right: "\x6B".freeze, # ┐ # \u2510 top_left: "\x6C".freeze, # ┌ # \u250C bottom_left: "\x6D".freeze, # └ # \u2514 horizontal: "\x71".freeze, # ─ # \u2500 vertical_left: "\x74".freeze, # ├ # \u251C vertical_right: "\x75".freeze, # ┤ # \u2524 horizontal_bottom: "\x76".freeze, # ┴ # \u2534 horizontal_top: "\x77".freeze, # ┬ # \u252C vertical: "\x78".freeze, # │ # \u2502 } end |
.define_borders! ⇒ void (private)
This method returns an undefined value.
60 61 62 |
# File 'lib/vedeu/esc/borders.rb', line 60 def define_borders! characters.each { |key, code| define_method(key) { code } } end |
.setup! ⇒ void
This method returns an undefined value.
53 54 55 |
# File 'lib/vedeu/esc/borders.rb', line 53 def setup! define_borders! end |
Instance Method Details
#border_off ⇒ String
26 27 28 |
# File 'lib/vedeu/esc/borders.rb', line 26 def border_off "\e(B".freeze end |
#border_on ⇒ String
21 22 23 |
# File 'lib/vedeu/esc/borders.rb', line 21 def border_on "\e(0".freeze end |
#characters ⇒ Hash<Symbol => String>
Provides all the semigraphic characters.
# 0 1 2 3 4 5 6 7 8 9 A B C D E F 6 ┘ ┐ ┌ └ ┼7 ─ ├ ┤ ┴ ┬ │
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/vedeu/esc/borders.rb', line 37 def characters { bottom_right: "\x6A".freeze, # ┘ # \u2518 top_right: "\x6B".freeze, # ┐ # \u2510 top_left: "\x6C".freeze, # ┌ # \u250C bottom_left: "\x6D".freeze, # └ # \u2514 horizontal: "\x71".freeze, # ─ # \u2500 vertical_left: "\x74".freeze, # ├ # \u251C vertical_right: "\x75".freeze, # ┤ # \u2524 horizontal_bottom: "\x76".freeze, # ┴ # \u2534 horizontal_top: "\x77".freeze, # ┬ # \u252C vertical: "\x78".freeze, # │ # \u2502 } end |
#define_borders! ⇒ void (private)
This method returns an undefined value.
60 61 62 |
# File 'lib/vedeu/esc/borders.rb', line 60 def define_borders! characters.each { |key, code| define_method(key) { code } } end |
#setup! ⇒ void
This method returns an undefined value.
53 54 55 |
# File 'lib/vedeu/esc/borders.rb', line 53 def setup! define_borders! end |