module CSVPP::OS
Provides utility functions for determining OS
and OS-specific system calls.
Public Instance Methods
linux?()
click to toggle source
# File lib/csvpp/os.rb, line 21 def linux? unix? && !mac? end
mac?()
click to toggle source
# File lib/csvpp/os.rb, line 17 def mac? !!(/darwin/ =~ ruby_platform) end
open(str, open_cmd: self.open_cmd)
click to toggle source
# File lib/csvpp/os.rb, line 25 def open(str, open_cmd: self.open_cmd) system "#{open_cmd} #{str}" end
open_cmd()
click to toggle source
# File lib/csvpp/os.rb, line 29 def open_cmd if mac? 'open' elsif linux? 'xdg-open' elsif windows? 'START ""' else raise 'Unsupported OS' end end
pager()
click to toggle source
# File lib/csvpp/os.rb, line 41 def pager return nil if windows? ENV['PAGER'] || 'less' end
ruby_platform()
click to toggle source
# File lib/csvpp/os.rb, line 46 def ruby_platform RUBY_PLATFORM end
unix?()
click to toggle source
# File lib/csvpp/os.rb, line 13 def unix? !windows? end
windows?()
click to toggle source
stackoverflow.com/a/171011/1314848.
# File lib/csvpp/os.rb, line 9 def windows? !!(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ ruby_platform) end