Class: PackageProtections::Private::ColorizedString
- Inherits:
-
Object
- Object
- PackageProtections::Private::ColorizedString
- Extended by:
- T::Sig
- Defined in:
- lib/package_protections/private/colorized_string.rb
Defined Under Namespace
Classes: Color
Instance Method Summary collapse
- #blue ⇒ Object
- #colorized_to_s ⇒ Object
- #green ⇒ Object
-
#initialize(original_string, color = Color::White) ⇒ ColorizedString
constructor
A new instance of ColorizedString.
- #light_blue ⇒ Object
- #pink ⇒ Object
- #red ⇒ Object
- #to_s ⇒ Object
- #white ⇒ Object
- #yellow ⇒ Object
Constructor Details
#initialize(original_string, color = Color::White) ⇒ ColorizedString
Returns a new instance of ColorizedString.
23 24 25 26 |
# File 'lib/package_protections/private/colorized_string.rb', line 23 def initialize(original_string, color = Color::White) @original_string = original_string @color = color end |
Instance Method Details
#blue ⇒ Object
54 55 56 |
# File 'lib/package_protections/private/colorized_string.rb', line 54 def blue colorize(Color::Blue) end |
#colorized_to_s ⇒ Object
29 30 31 |
# File 'lib/package_protections/private/colorized_string.rb', line 29 def colorized_to_s "\e[#{color_code}m#{@original_string}\e[0m" end |
#green ⇒ Object
44 45 46 |
# File 'lib/package_protections/private/colorized_string.rb', line 44 def green colorize(Color::Green) end |
#light_blue ⇒ Object
64 65 66 |
# File 'lib/package_protections/private/colorized_string.rb', line 64 def light_blue colorize(Color::LightBlue) end |
#pink ⇒ Object
59 60 61 |
# File 'lib/package_protections/private/colorized_string.rb', line 59 def pink colorize(Color::Pink) end |
#red ⇒ Object
39 40 41 |
# File 'lib/package_protections/private/colorized_string.rb', line 39 def red colorize(Color::Red) end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/package_protections/private/colorized_string.rb', line 34 def to_s @original_string end |
#white ⇒ Object
69 70 71 |
# File 'lib/package_protections/private/colorized_string.rb', line 69 def white colorize(Color::White) end |
#yellow ⇒ Object
49 50 51 |
# File 'lib/package_protections/private/colorized_string.rb', line 49 def yellow colorize(Color::Yellow) end |