summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbinoam P. Marques Jr <abinoam@gmail.com>2017-06-24 10:55:33 -0300
committerAbinoam P. Marques Jr <abinoam@gmail.com>2017-06-24 13:44:09 -0300
commit8e3425b62d291c85329acd5e33b5eab736083260 (patch)
tree28581aec15363d6dae519e29a4fe5e92ba721670
parent36bd9f6398e957e5281b0476214ce5535065c945 (diff)
downloadhighline-8e3425b62d291c85329acd5e33b5eab736083260.tar.gz
Clone HighLine.color method
-rwxr-xr-xlib/highline.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/highline.rb b/lib/highline.rb
index c7e2c2a..6162b25 100755
--- a/lib/highline.rb
+++ b/lib/highline.rb
@@ -310,9 +310,11 @@ class HighLine
end
# (see .color)
- # Convenience instance method. It delegates to the class method.
+ # This method is a clone of the HighLine.color class method.
+ # But it checks for use_color? per instance
def color(string, *colors)
- self.class.color(string, *colors)
+ return string unless use_color?
+ Style(*colors).color(string)
end
# In case you just want the color code, without the embedding and