Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/cliutils/ext/String+Extensions.rb
Overview
String Class
======================================================
Instance Method Summary (collapse)
- - (Object) blue
-
- (Object) colorize(color_code)
Color String Methods ==================================================== —————————————————- colorize method.
- - (Object) cyan
- - (Object) green
- - (Object) purple
- - (Object) red
- - (Object) white
- - (Object) yellow
Instance Method Details
- (Object) blue
19 |
# File 'lib/cliutils/ext/String+Extensions.rb', line 19 def blue; colorize(34) end |
- (Object) colorize(color_code)
Color String Methods
====================================================
----------------------------------------------------
colorize method
Outputs a string in a formatted color.
@param color_code The code to use
@return Void
----------------------------------------------------
15 16 17 |
# File 'lib/cliutils/ext/String+Extensions.rb', line 15 def colorize(color_code) "\033[#{ color_code }m#{ self }\033[0m" end |
- (Object) cyan
20 |
# File 'lib/cliutils/ext/String+Extensions.rb', line 20 def cyan; colorize(36) end |
- (Object) green
21 |
# File 'lib/cliutils/ext/String+Extensions.rb', line 21 def green; colorize(32) end |
- (Object) purple
22 |
# File 'lib/cliutils/ext/String+Extensions.rb', line 22 def purple; colorize(35) end |
- (Object) red
23 |
# File 'lib/cliutils/ext/String+Extensions.rb', line 23 def red; colorize(31) end |
- (Object) white
24 |
# File 'lib/cliutils/ext/String+Extensions.rb', line 24 def white; colorize(37) end |
- (Object) yellow
25 |
# File 'lib/cliutils/ext/String+Extensions.rb', line 25 def yellow; colorize(33) end |