Module: RbConfig

Included in:
RubyLibrary
Defined in:
lib/library/rbconfig.rb

Constant Summary collapse

WIN_PATTERNS =

Patterns used to identiy a Windows platform.

[
  /bccwin/i,
  /cygwin/i,
  /djgpp/i,
  /mingw/i,
  /mswin/i,
  /wince/i,
]

Class Method Summary collapse

Class Method Details

.confdir(name) ⇒ Object

Return the path to the configuration directory.



29
30
31
32
33
34
35
# File 'lib/library/rbconfig.rb', line 29

def self.confdir(name)
  if lib = Roll::Library.instance(name)
    lib.confdir
  else
    File.join(CONFIG['confdir'], name)
  end
end

.datadir(name, versionless = false) ⇒ Object

Return the path to the data directory associated with the given library name.

Normally this is just:

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

But it may be modified by packages like RubyGems and Rolls to handle versioned data directories.



16
17
18
19
20
21
22
23
24
# File 'lib/library/rbconfig.rb', line 16

def self.datadir(name, versionless=false)
  if lib = Library.instance(name)
    lib.datadir(versionless)
  elsif defined?(super)
    super(name)
  else
    File.join(CONFIG['datadir'], name)
  end
end

.windows_platform?Boolean

Is this a windows platform? This method compares the entires in WIN_PATTERNS against RUBY_PLATFORM.

Returns:

  • (Boolean)


55
56
57
58
59
60
61
62
# File 'lib/library/rbconfig.rb', line 55

def self.windows_platform?
  case RUBY_PLATFORM
  when *WIN_PATTERNS
    true
  else
    false
  end
end