module RbConfig

An extended rendition of the Ruby’s standard RbConfig module.

Public Class Methods

datadir(package_name) click to toggle source

Return the path to the data directory associated with the given library/package name. Normally this is just

"#{Config::CONFIG['datadir']}/#{name}"

but may be modified by tools like RubyGems to handle versioned data directories.

# File lib/standard/facets/rbconfig.rb, line 32
def self.datadir(package_name)
  File.join(CONFIG['datadir'], package_name)
end
host_os() click to toggle source
# File lib/standard/facets/rbconfig.rb, line 38
def self.host_os
  CONFIG['host_os']
end
inspect() click to toggle source
# File lib/standard/facets/rbconfig.rb, line 5
def self.inspect
  CONFIG.inspect
end
method_missing(s,*a,&b) click to toggle source

Methodized lookup of config.

# File lib/standard/facets/rbconfig.rb, line 10
def self.method_missing(s,*a,&b)
  s = s.to_s
  if CONFIG.key?(s)
    CONFIG[s]
  elsif CONFIG.key?(s.upcase)
    CONFIG[s.upcase]
  else
    super(s,*a,&b)
  end
end

Public Instance Methods

bsd?() click to toggle source
# File lib/standard/facets/rbconfig.rb, line 50
def bsd?
  host_os =~ /bsd/
end
linux?() click to toggle source
# File lib/standard/facets/rbconfig.rb, line 42
def linux?
  host_os =~ /linux|cygwin/
end
mac?() click to toggle source
# File lib/standard/facets/rbconfig.rb, line 46
def mac?
  host_os =~ /mac|darwin/
end
posix?() click to toggle source
# File lib/standard/facets/rbconfig.rb, line 68
def posix?
  linux? or mac? or bsd? or solaris? or begin 
    fork do end
    true
  rescue NotImplementedError, NoMethodError
    false
  end
end
solaris?() click to toggle source
# File lib/standard/facets/rbconfig.rb, line 58
def solaris?
  host_os =~ /solaris|sunos/
end
symbian?() click to toggle source

TODO: who knows what symbian returns?

# File lib/standard/facets/rbconfig.rb, line 63
def symbian?
  host_os =~ /symbian/
end
windows?() click to toggle source
# File lib/standard/facets/rbconfig.rb, line 54
def windows?
  host_os =~ /mswin|mingw/
end