Module: RbConfig
- Defined in:
- lib/standard/facets/rbconfig.rb
Overview
An extended rendition of the Ruby’s standard RbConfig module.
Class Method Summary collapse
-
.datadir(package_name) ⇒ Object
Return the path to the data directory associated with the given library/package name.
- .host_os ⇒ Object
- .inspect ⇒ Object
-
.method_missing(s, *a, &b) ⇒ Object
Methodized lookup of config.
Instance Method Summary collapse
- #bsd? ⇒ Boolean
- #linux? ⇒ Boolean
- #mac? ⇒ Boolean
- #posix? ⇒ Boolean
- #solaris? ⇒ Boolean
-
#symbian? ⇒ Boolean
TODO: who knows what symbian returns?.
- #windows? ⇒ Boolean
Class Method Details
.datadir(package_name) ⇒ Object
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.
32 33 34 |
# File 'lib/standard/facets/rbconfig.rb', line 32 def self.datadir(package_name) File.join(CONFIG['datadir'], package_name) end |
.host_os ⇒ Object
38 39 40 |
# File 'lib/standard/facets/rbconfig.rb', line 38 def self.host_os CONFIG['host_os'] end |
.inspect ⇒ Object
5 6 7 |
# File 'lib/standard/facets/rbconfig.rb', line 5 def self.inspect CONFIG.inspect end |
.method_missing(s, *a, &b) ⇒ Object
Methodized lookup of config.
10 11 12 13 14 15 16 17 18 19 |
# 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 |
Instance Method Details
#bsd? ⇒ Boolean
50 51 52 |
# File 'lib/standard/facets/rbconfig.rb', line 50 def bsd? host_os =~ /bsd/ end |
#linux? ⇒ Boolean
42 43 44 |
# File 'lib/standard/facets/rbconfig.rb', line 42 def linux? host_os =~ /linux|cygwin/ end |
#mac? ⇒ Boolean
46 47 48 |
# File 'lib/standard/facets/rbconfig.rb', line 46 def mac? host_os =~ /mac|darwin/ end |
#posix? ⇒ Boolean
68 69 70 71 72 73 74 75 |
# 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? ⇒ Boolean
58 59 60 |
# File 'lib/standard/facets/rbconfig.rb', line 58 def solaris? host_os =~ /solaris|sunos/ end |
#symbian? ⇒ Boolean
TODO: who knows what symbian returns?
63 64 65 |
# File 'lib/standard/facets/rbconfig.rb', line 63 def symbian? host_os =~ /symbian/ end |
#windows? ⇒ Boolean
54 55 56 |
# File 'lib/standard/facets/rbconfig.rb', line 54 def windows? host_os =~ /mswin|mingw/ end |