Class: Troo::Formatter
- Inherits:
-
Object
- Object
- Troo::Formatter
- Defined in:
- lib/troo/presentation/formatter.rb
Class Method Summary collapse
-
.error(value) ⇒ Object
[].
-
.highlight(value, options = {}) ⇒ Object
[].
-
.wordwrap(value, width = 70) ⇒ Object
[].
Instance Method Summary collapse
Class Method Details
.error(value) ⇒ Object
Returns [].
51 52 53 54 |
# File 'lib/troo/presentation/formatter.rb', line 51 def error(value) new(value: value, options: { colour: Esc.red }).error end |
.highlight(value, options = {}) ⇒ Object
Returns [].
45 46 47 |
# File 'lib/troo/presentation/formatter.rb', line 45 def highlight(value, = {}) new(value: value, options: ).highlight end |
.wordwrap(value, width = 70) ⇒ Object
Returns [].
59 60 61 62 |
# File 'lib/troo/presentation/formatter.rb', line 59 def wordwrap(value, width = 70) new(value: value, options: { align: { width: width } }).wordwrap end |
Instance Method Details
#error ⇒ String
76 77 78 79 80 81 82 |
# File 'lib/troo/presentation/formatter.rb', line 76 def error [ .colour, formatted_value, .reset ].join end |
#highlight ⇒ String
66 67 68 69 70 71 72 73 |
# File 'lib/troo/presentation/formatter.rb', line 66 def highlight [ .colour, .underline, formatted_value, .reset ].join end |