Class: Tty
- Inherits:
-
Object
- Object
- Tty
- Defined in:
- lib/lace/utils.rb
Overview
Copyright 2009-2014 Max Howell and other contributors.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Class Method Summary collapse
- .blue ⇒ Object
- .em ⇒ Object
- .gray ⇒ Object
- .green ⇒ Object
- .red ⇒ Object
- .reset ⇒ Object
- .truncate(str) ⇒ Object
- .white ⇒ Object
- .width ⇒ Object
- .yellow ⇒ Object
Class Method Details
.blue ⇒ Object
26 |
# File 'lib/lace/utils.rb', line 26 def blue; bold 34; end |
.em ⇒ Object
31 |
# File 'lib/lace/utils.rb', line 31 def em; underline 39; end |
.gray ⇒ Object
33 |
# File 'lib/lace/utils.rb', line 33 def gray; bold 30 end |
.green ⇒ Object
32 |
# File 'lib/lace/utils.rb', line 32 def green; color 92 end |
.red ⇒ Object
28 |
# File 'lib/lace/utils.rb', line 28 def red; underline 31; end |
.reset ⇒ Object
30 |
# File 'lib/lace/utils.rb', line 30 def reset; escape 0; end |
.truncate(str) ⇒ Object
39 40 41 |
# File 'lib/lace/utils.rb', line 39 def truncate(str) str.to_s[0, width - 4] end |
.white ⇒ Object
27 |
# File 'lib/lace/utils.rb', line 27 def white; bold 39; end |
.width ⇒ Object
35 36 37 |
# File 'lib/lace/utils.rb', line 35 def width `/usr/bin/tput cols`.strip.to_i end |
.yellow ⇒ Object
29 |
# File 'lib/lace/utils.rb', line 29 def yellow; underline 33 ; end |