Sha256: 1fb0288217a75fd6d322a457833482a879a8d9fe8f1aeba43d20bc522e637349

Contents?: true

Size: 673 Bytes

Versions: 3

Compression:

Stored size: 673 Bytes

Contents

# From
# http://rbjl.net/
# Ruby Zucker
require 'rbconfig'; RbConfig::CONFIG['host_os']

module OS
  class << self
    def is?(what)
      what === RbConfig::CONFIG['host_os']
    end
    alias is is?

    def to_s
      RbConfig::CONFIG['host_os']
    end
  end

  module_function

  def linux?
    OS.is? /linux|cygwin/
  end

  def mac?
    OS.is? /mac|darwin/
  end

  def bsd?
    OS.is? /bsd/
  end

  def windows?
    OS.is? /mswin|win|mingw/
  end

  def solaris?
    OS.is? /solaris|sunos/
  end

  def posix?
    linux? or mac? or bsd? or solaris? or Process.respond_to?(:fork)
  end

  #def symbian?
    #TODO who knows what symbian returns?
  #end

  # ...
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
subduino-0.5.0 lib/subduino/os.rb
subduino-0.3.1 lib/subduino/os.rb
subduino-0.2.2 lib/subduino/os.rb