class Shop::Platform

Public Instance Methods

darwin?() click to toggle source

Public: tests if currently running on darwin.

Returns true if running on darwin (MacOS X), else false

# File lib/shop/platform.rb, line 10
def darwin?
  !!(RUBY_PLATFORM =~ /darwin/)
end
open_command() click to toggle source

Public: returns the command used to open a file or URL for the current platform.

Currently only supports MacOS X and Linux with ‘xdg-open`.

Returns a String with the bin

# File lib/shop/platform.rb, line 29
def open_command
  if darwin?
    'open'
  elsif windows?
    'start'
  else
    'xdg-open'
  end
end
windows?() click to toggle source

Public: tests if currently running on windows.

Apparently Windows RUBY_PLATFORM can be ‘win32’ or ‘mingw32’

Returns true if running on windows (win32/mingw32), else false

# File lib/shop/platform.rb, line 19
def windows?
  !!(RUBY_PLATFORM =~ /mswin|mingw/)
end