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
- .linux? ⇒ Boolean
- .osx? ⇒ Boolean
-
.type ⇒ Object
Return OS type.
- .win32? ⇒ Boolean
Class Method Details
.linux? ⇒ Boolean
53 54 55 |
# File 'lib/bowline/platform.rb', line 53 def linux? IMPL == :linux end |
.osx? ⇒ Boolean
48 49 50 |
# File 'lib/bowline/platform.rb', line 48 def osx? IMPL == :macosx end |
.type ⇒ Object
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
58 59 60 |
# File 'lib/bowline/platform.rb', line 58 def win32? OS == :win32 end |