Sha256: 58238e34fc06615467f36c18620fdeacdf7d47bb902d482d34ba4db50b21ad99
Contents?: true
Size: 668 Bytes
Versions: 1
Compression:
Stored size: 668 Bytes
Contents
# encoding: utf-8 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cri-2.7.0 | lib/cri/platform.rb |