Sha256: 8605e1db3844f7e8962eb134b01f79cf46775041d7355912c9444cd121e753ca
Contents?: true
Size: 649 Bytes
Versions: 6
Compression:
Stored size: 649 Bytes
Contents
module Cri module Platform # @return [Boolean] true if the current platform is Windows, false # otherwise. def self.windows? RUBY_PLATFORM =~ /windows|bccwin|cygwin|djgpp|mingw|mswin|wince/i end # Checks whether colors can be enabled. For colors to be enabled, the given # IO should be a TTY, and, when on Windows, ::Win32::Console::ANSI needs to # be defined. # # @return [Boolean] True if colors should be enabled, false otherwise. def self.color?(io) if !io.tty? false elsif windows? defined?(::Win32::Console::ANSI) else true end end end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
cri-2.10.1 | lib/cri/platform.rb |
cri-2.10.0 | lib/cri/platform.rb |
cri-2.9.1 | lib/cri/platform.rb |
cri-2.9.0 | lib/cri/platform.rb |
cri-2.8.0 | lib/cri/platform.rb |
cri-2.7.1 | lib/cri/platform.rb |