Sha256: f85b3c623e63e4842d8d4d9040f052ee660a503c09f9723b66ec2dbc6ac54ffe
Contents?: true
Size: 676 Bytes
Versions: 1
Compression:
Stored size: 676 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.6.1 | lib/cri/platform.rb |