Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/patch.rb,
lib/patch.rb
Instance Method Summary collapse
- #blue ⇒ Object
- #bold ⇒ Object
- #cls ⇒ Object
- #cls_upline ⇒ Object
- #colorize(text, color_code) ⇒ Object
- #cursor(text, position) ⇒ Object
- #cyan ⇒ Object
- #dark_blue ⇒ Object
- #dark_cyan ⇒ Object
- #dark_green ⇒ Object
- #dark_purple ⇒ Object
- #green ⇒ Object
- #mv_bw(n = 1) ⇒ Object
- #mv_down(n = 1) ⇒ Object
- #mv_fw(n = 1) ⇒ Object
- #mv_up(n = 1) ⇒ Object
- #pure ⇒ Object
- #purple ⇒ Object
- #red ⇒ Object
- #restore_position ⇒ Object
- #save_position ⇒ Object
- #yellow ⇒ Object
Instance Method Details
#blue ⇒ Object
8 |
# File 'lib/patch.rb', line 8 def blue = colorize(self, "\e[1m\e[34m") |
#bold ⇒ Object
15 |
# File 'lib/patch.rb', line 15 def bold = colorize(self, "\e[1m") |
#cls ⇒ Object
40 41 42 43 |
# File 'lib/patch.rb', line 40 def cls # cursor(self, "\033[2J") cursor(self, "\e[H\e[2J") end |
#cls_upline ⇒ Object
36 37 38 |
# File 'lib/patch.rb', line 36 def cls_upline cursor(self, "\e[K") end |
#colorize(text, color_code) ⇒ Object
16 |
# File 'lib/patch.rb', line 16 def colorize(text, color_code) = "#{color_code}#{text}\e[0m" |
#cursor(text, position) ⇒ Object
53 54 55 |
# File 'lib/patch.rb', line 53 def cursor(text, position) "\r#{position}#{text}" end |
#cyan ⇒ Object
12 |
# File 'lib/patch.rb', line 12 def cyan = colorize(self, "\e[1;36m") |
#dark_blue ⇒ Object
9 |
# File 'lib/patch.rb', line 9 def dark_blue = colorize(self, "\e[34m") |
#dark_cyan ⇒ Object
13 |
# File 'lib/patch.rb', line 13 def dark_cyan = colorize(self, "\e[36m") |
#dark_green ⇒ Object
6 |
# File 'lib/patch.rb', line 6 def dark_green = colorize(self, "\e[32m") |
#dark_purple ⇒ Object
11 |
# File 'lib/patch.rb', line 11 def dark_purple = colorize(self, "\e[1;35m") |
#green ⇒ Object
5 |
# File 'lib/patch.rb', line 5 def green = colorize(self, "\e[1m\e[32m") |
#mv_bw(n = 1) ⇒ Object
32 33 34 |
# File 'lib/patch.rb', line 32 def mv_bw(n = 1) cursor(self, "\033[#{n}D") end |
#mv_down(n = 1) ⇒ Object
24 25 26 |
# File 'lib/patch.rb', line 24 def mv_down(n = 1) cursor(self, "\033[#{n}B") end |
#mv_fw(n = 1) ⇒ Object
28 29 30 |
# File 'lib/patch.rb', line 28 def mv_fw(n = 1) cursor(self, "\033[#{n}C") end |
#mv_up(n = 1) ⇒ Object
20 21 22 |
# File 'lib/patch.rb', line 20 def mv_up(n = 1) cursor(self, "\033[#{n}A") end |
#pure ⇒ Object
14 |
# File 'lib/patch.rb', line 14 def pure = colorize(self, "\e[0m\e[28m") |
#purple ⇒ Object
10 |
# File 'lib/patch.rb', line 10 def purple = colorize(self, "\e[35m") |
#red ⇒ Object
4 |
# File 'lib/patch.rb', line 4 def red = colorize(self, "\e[1m\e[31m") |
#restore_position ⇒ Object
49 50 51 |
# File 'lib/patch.rb', line 49 def restore_position cursor(self, "\033[u") end |
#save_position ⇒ Object
45 46 47 |
# File 'lib/patch.rb', line 45 def save_position cursor(self, "\033[s") end |
#yellow ⇒ Object
7 |
# File 'lib/patch.rb', line 7 def yellow = colorize(self, "\e[1m\e[33m") |