File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ module Colorize
8080 # If this value is `true`, `Colorize::Object` is enabled by default.
8181 # But if this value is `false`, `Colorize::Object` is disabled.
8282 #
83- # This defaule value is `true` only if both of `STDOUT.tty?` and `STDERR.tty?` are `true`.
83+ # The default value is `true`.
8484 #
8585 # ```
8686 # Colorize.enabled = true
@@ -89,7 +89,12 @@ module Colorize
8989 # Colorize.enabled = false
9090 # "hello".colorize.red.to_s # => "hello"
9191 # ```
92- class_property? enabled : Bool = STDOUT .tty? && STDERR .tty?
92+ class_property? enabled : Bool = true
93+
94+ # Make `Colorize.enabled` `true` if and only if both of `STDOUT.tty?` and `STDERR.tty?` are `true`.
95+ def self.on_tty_only !
96+ self .enabled = STDOUT .tty? && STDERR .tty?
97+ end
9398end
9499
95100def with_color
You can’t perform that action at this time.
0 commit comments