Module: ScreenRecorder::OS Private
- Defined in:
- lib/screen-recorder/os.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
- .cygwin? ⇒ Boolean private
- .cygwin_path(path, only_cygwin: false, **opts) ⇒ Object private
- .engine ⇒ Object private
- .home ⇒ Object private
- .jruby? ⇒ Boolean private
- .linux? ⇒ Boolean private
- .mac? ⇒ Boolean private
- .null_device ⇒ Object private
- .os ⇒ Object private
- .ruby_version ⇒ Object private
- .truffleruby? ⇒ Boolean private
- .unix? ⇒ Boolean private
- .unix_path(path) ⇒ Object private
- .windows? ⇒ Boolean private
- .windows_path(path) ⇒ Object private
- .wsl? ⇒ Boolean private
Class Method Details
.cygwin? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
67 68 69 |
# File 'lib/screen-recorder/os.rb', line 67 def cygwin? RUBY_PLATFORM.include?('cygwin') end |
.cygwin_path(path, only_cygwin: false, **opts) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
75 76 77 78 79 80 81 82 |
# File 'lib/screen-recorder/os.rb', line 75 def cygwin_path(path, only_cygwin: false, **opts) return path if only_cygwin && !cygwin? flags = [] opts.each { |k, v| flags << "--#{k}" if v } `cygpath #{flags.join ' '} "#{path}"`.strip end |
.engine ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/screen-recorder/os.rb', line 10 def engine @engine ||= RUBY_ENGINE.to_sym end |
.home ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'lib/screen-recorder/os.rb', line 6 def home @home ||= Dir.home end |
.jruby? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 |
# File 'lib/screen-recorder/os.rb', line 30 def jruby? engine == :jruby end |
.linux? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
50 51 52 |
# File 'lib/screen-recorder/os.rb', line 50 def linux? os == :linux end |
.mac? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 |
# File 'lib/screen-recorder/os.rb', line 46 def mac? os == :macosx end |
.null_device ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
71 72 73 |
# File 'lib/screen-recorder/os.rb', line 71 def null_device File::NULL end |
.os ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/screen-recorder/os.rb', line 14 def os host_os = RbConfig::CONFIG['host_os'] @os ||= case host_os when /mswin|msys|mingw|cygwin|bccwin|wince|emc/ :windows when /darwin|mac os/ :macosx when /linux/ :linux when /solaris|bsd/ :unix else raise Error::WebDriverError, "unknown os: #{host_os.inspect}" end end |
.ruby_version ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 |
# File 'lib/screen-recorder/os.rb', line 38 def ruby_version RUBY_VERSION end |
.truffleruby? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 |
# File 'lib/screen-recorder/os.rb', line 34 def truffleruby? engine == :truffleruby end |
.unix? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
54 55 56 |
# File 'lib/screen-recorder/os.rb', line 54 def unix? os == :unix end |
.unix_path(path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
84 85 86 |
# File 'lib/screen-recorder/os.rb', line 84 def unix_path(path) path.tr(File::ALT_SEPARATOR, File::SEPARATOR) end |
.windows? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 |
# File 'lib/screen-recorder/os.rb', line 42 def windows? os == :windows end |
.windows_path(path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
88 89 90 |
# File 'lib/screen-recorder/os.rb', line 88 def windows_path(path) path.tr(File::SEPARATOR, File::ALT_SEPARATOR) end |
.wsl? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
58 59 60 61 62 63 64 65 |
# File 'lib/screen-recorder/os.rb', line 58 def wsl? return false unless linux? File.read('/proc/version').downcase.include?('microsoft') rescue Errno::EACCES # the file cannot be accessed on Linux on DeX false end |