Sha256: 620b3385d2949bb82fe87c86b38dc6659c7dbe3bbe28182d3e03d4a4db0a8957
Contents?: true
Size: 851 Bytes
Versions: 1
Compression:
Stored size: 851 Bytes
Contents
# frozen_string_literal: true module CSVPP # Provides utility functions for determining OS and OS-specific system calls. module OS module_function # http://stackoverflow.com/a/171011/1314848. def windows? !!(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ ruby_platform) end def unix? !windows? end def mac? !!(/darwin/ =~ ruby_platform) end def linux? unix? && !mac? end def open(str, open_cmd: self.open_cmd) system "#{open_cmd} #{str}" end def open_cmd if mac? 'open' elsif linux? 'xdg-open' elsif windows? 'START ""' else raise 'Unsupported OS' end end def pager return nil if windows? ENV['PAGER'] || 'less' end def ruby_platform RUBY_PLATFORM end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
csvpp-0.4.0 | lib/csvpp/os.rb |