diff options
author | Abinoam P. Marques Jr <abinoam@gmail.com> | 2017-06-24 14:39:00 -0300 |
---|---|---|
committer | Abinoam P. Marques Jr <abinoam@gmail.com> | 2017-06-24 14:39:01 -0300 |
commit | 10fe55dd12e9485a3006d70177c1404902f3e8a3 (patch) | |
tree | b7bb08327ce4ceeb972e23e06cd0c80fae647587 | |
parent | 1ebb6a8c70ad4fa0ae0afc9cbd6eaa44b014c39b (diff) | |
download | highline-10fe55dd12e9485a3006d70177c1404902f3e8a3.tar.gz |
Move HighLine.use_color= and use_color? to import.rb
Now these methods depend on $terminal.
And $terminal is set only on import.rb.
So, it make sense to them to be there.
-rwxr-xr-x | lib/highline.rb | 10 | ||||
-rw-r--r-- | lib/highline/import.rb | 12 |
2 files changed, 12 insertions, 10 deletions
diff --git a/lib/highline.rb b/lib/highline.rb index 53a4bf7..33ae934 100755 --- a/lib/highline.rb +++ b/lib/highline.rb @@ -44,19 +44,9 @@ class HighLine include BuiltinStyles include CustomErrors - # Pass +false+ to _setting_ to turn off HighLine's color escapes. - def self.use_color=( setting ) - $terminal.use_color = setting - end - # Set it to false to disable ANSI coloring attr_writer :use_color - # Returns true if HighLine is currently using color escapes. - def self.use_color? - $terminal.use_color? - end - # Returns true if HighLine instance is currently using color escapes. def use_color? @use_color diff --git a/lib/highline/import.rb b/lib/highline/import.rb index 6f31de8..d4e70f5 100644 --- a/lib/highline/import.rb +++ b/lib/highline/import.rb @@ -48,3 +48,15 @@ class Object end end end + +class HighLine + # Pass +false+ to _setting_ to turn off HighLine's color escapes. + def self.use_color=(setting) + $terminal.use_color = setting + end + + # Returns true if HighLine is currently using color escapes. + def self.use_color? + $terminal.use_color? + end +end |