Module: Bowline::Platform

Defined in:
lib/bowline/platform.rb

Overview

Naive platform detection for Ruby

Based on code by Matt Mower <[email protected]> matt.blogs.it/gems/ruby/platform.rb

Constant Summary collapse

OS =
:unknown
IMPL =
:unknown
ARCH =
:unknown

Class Method Summary collapse

Class Method Details

.linux?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/bowline/platform.rb', line 53

def linux?
  IMPL == :linux
end

.osx?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/bowline/platform.rb', line 48

def osx?
  IMPL == :macosx
end

.typeObject

Return OS type. An error is raised on platforms unsupported by Bowline. Example:

Bowline::Platform.type # => :osx


67
68
69
70
71
72
# File 'lib/bowline/platform.rb', line 67

def type
  return :osx   if osx?
  return :linux if linux?
  return :win32 if win32?
  raise "Unknown platform"
end

.win32?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/bowline/platform.rb', line 58

def win32?
  OS == :win32
end