Module: HackerNote::Extensions::String
- Defined in:
- lib/hackernote/extensions.rb
Instance Method Summary collapse
- #blue ⇒ Object
- #bold ⇒ 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_down(n = 1) ⇒ Object
Cursor.
- #pure ⇒ Object
- #purple ⇒ Object
-
#red ⇒ Object
Colors.
- #reset ⇒ Object
- #underline ⇒ Object
- #yellow ⇒ Object
Instance Method Details
#blue ⇒ Object
9 |
# File 'lib/hackernote/extensions.rb', line 9 def blue; colorize(self, "\e[1m\e[34m"); end |
#bold ⇒ Object
17 |
# File 'lib/hackernote/extensions.rb', line 17 def bold; colorize(self, "\e[1m"); end |
#cls_upline ⇒ Object
23 |
# File 'lib/hackernote/extensions.rb', line 23 def cls_upline; cursor(self, "\e[K") end |
#colorize(text, color_code) ⇒ Object
19 |
# File 'lib/hackernote/extensions.rb', line 19 def colorize(text, color_code) "#{color_code}#{text}\e[0m" end |
#cursor(text, position) ⇒ Object
24 |
# File 'lib/hackernote/extensions.rb', line 24 def cursor(text, position)"\r#{position}#{text}" end |
#cyan ⇒ Object
13 |
# File 'lib/hackernote/extensions.rb', line 13 def cyan; colorize(self, "\e[1;36m"); end |
#dark_blue ⇒ Object
10 |
# File 'lib/hackernote/extensions.rb', line 10 def dark_blue; colorize(self, "\e[34m"); end |
#dark_cyan ⇒ Object
14 |
# File 'lib/hackernote/extensions.rb', line 14 def dark_cyan; colorize(self, "\e[36m"); end |
#dark_green ⇒ Object
7 |
# File 'lib/hackernote/extensions.rb', line 7 def dark_green; colorize(self, "\e[32m"); end |
#dark_purple ⇒ Object
12 |
# File 'lib/hackernote/extensions.rb', line 12 def dark_purple; colorize(self, "\e[1;35m"); end |
#green ⇒ Object
6 |
# File 'lib/hackernote/extensions.rb', line 6 def green; colorize(self, "\e[1m\e[32m"); end |
#mv_down(n = 1) ⇒ Object
Cursor
22 |
# File 'lib/hackernote/extensions.rb', line 22 def mv_down(n=1) cursor(self, "\033[#{n}B") end |
#pure ⇒ Object
15 |
# File 'lib/hackernote/extensions.rb', line 15 def pure; colorize(self, "\e[0m\e[28m"); end |
#purple ⇒ Object
11 |
# File 'lib/hackernote/extensions.rb', line 11 def purple; colorize(self, "\e[35m"); end |
#red ⇒ Object
Colors
5 |
# File 'lib/hackernote/extensions.rb', line 5 def red; colorize(self, "\e[1m\e[31m"); end |
#reset ⇒ Object
18 |
# File 'lib/hackernote/extensions.rb', line 18 def reset; colorize(self, "\e[0m\e[28m"); end |
#underline ⇒ Object
16 |
# File 'lib/hackernote/extensions.rb', line 16 def underline; colorize(self, "\e[4m"); end |
#yellow ⇒ Object
8 |
# File 'lib/hackernote/extensions.rb', line 8 def yellow; colorize(self, "\e[1m\e[33m"); end |