diff options
author | Kyrylo Silin <silin@kyrylo.org> | 2019-05-26 12:52:28 +0300 |
---|---|---|
committer | Kyrylo Silin <silin@kyrylo.org> | 2019-05-26 12:52:28 +0300 |
commit | 23a3217f64baa61699b763197fc78f62b164f31b (patch) | |
tree | e4958e1ddc0bb2944c5f4d7f283efd496e40cc11 | |
parent | e7721ff5407831a71573ee0373c2f10baed0830f (diff) | |
download | pry-23a3217f64baa61699b763197fc78f62b164f31b.tar.gz |
output: assign @color inside initialize
Just a shortcut, so we don't expose the whole pry_instance to all of the class.
-rw-r--r-- | lib/pry/output.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/pry/output.rb b/lib/pry/output.rb index 34a222d2..91373843 100644 --- a/lib/pry/output.rb +++ b/lib/pry/output.rb @@ -5,8 +5,8 @@ class Pry attr_reader :pry_instance def initialize(pry_instance) - @pry_instance = pry_instance @output = pry_instance.config.output + @color = pry_instance.config.color end def puts(*objs) @@ -48,11 +48,9 @@ class Pry end def decolorize_maybe(str) - if pry_instance.config.color - str - else - Pry::Helpers::Text.strip_color str - end + return str if @color + + Pry::Helpers::Text.strip_color(str) end end end |