Module: Bowline::Platform

Defined in:
lib/bowline/platform.rb

Overview

Naive platform detection for Ruby

Based on code by Matt Mower <self@mattmower.com> matt.blogs.it/gems/ruby/platform.rb

Constant Summary

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) linux?

Returns:

  • (Boolean)


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

def linux?
  IMPL == :linux
end

- (Boolean) osx?

Returns:

  • (Boolean)


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

def osx?
  IMPL == :macosx
end

- (Object) type

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

- (Boolean) win32?

Returns:

  • (Boolean)


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

def win32?
  OS == :win32
end