Module: Spellr::StringFormat
- Included in:
- BaseReporter, Check, InteractiveAdd, InteractiveReplacement
- Defined in:
- lib/spellr/string_format.rb
Class Method Summary collapse
- .aqua(text) ⇒ Object
- .bold(text) ⇒ Object
- .green(text) ⇒ Object
- .key(label) ⇒ Object
- .lighten(text) ⇒ Object
- .normal(text = '') ⇒ Object
- .pluralize(word, count) ⇒ Object
- .red(text) ⇒ Object
Class Method Details
.aqua(text) ⇒ Object
11 12 13 |
# File 'lib/spellr/string_format.rb', line 11 def aqua(text) "\e[36m#{text}#{normal}" end |
.bold(text) ⇒ Object
19 20 21 |
# File 'lib/spellr/string_format.rb', line 19 def bold(text) "\e[1;39m#{text}#{normal}" end |
.green(text) ⇒ Object
31 32 33 |
# File 'lib/spellr/string_format.rb', line 31 def green(text) "\e[1;32m#{text}#{normal}" end |
.key(label) ⇒ Object
35 36 37 |
# File 'lib/spellr/string_format.rb', line 35 def key(label) "[#{bold label[0]}]#{label[1..-1]}" end |
.lighten(text) ⇒ Object
23 24 25 |
# File 'lib/spellr/string_format.rb', line 23 def lighten(text) "\e[2;39m#{text}#{normal}" end |
.normal(text = '') ⇒ Object
15 16 17 |
# File 'lib/spellr/string_format.rb', line 15 def normal(text = '') "\e[0m#{text}" end |
.pluralize(word, count) ⇒ Object
7 8 9 |
# File 'lib/spellr/string_format.rb', line 7 def pluralize(word, count) "#{count} #{word}#{'s' if count != 1}" end |
.red(text) ⇒ Object
27 28 29 |
# File 'lib/spellr/string_format.rb', line 27 def red(text) "\e[1;31m#{text}#{normal}" end |