Module: OS
- Defined in:
- lib/os-name.rb,
lib/os-name/version.rb
Constant Summary collapse
- VERSION =
'0.0.4'
Class Method Summary collapse
- .bsd? ⇒ Boolean
- .linux? ⇒ Boolean
- .name ⇒ Object (also: to_s)
- .osx? ⇒ Boolean
- .solaris? ⇒ Boolean
- .to_sym ⇒ Object (also: intern)
- .windows? ⇒ Boolean
Class Method Details
.bsd? ⇒ Boolean
48 49 50 |
# File 'lib/os-name.rb', line 48 def bsd? name == 'BSD' end |
.linux? ⇒ Boolean
32 33 34 |
# File 'lib/os-name.rb', line 32 def linux? name == 'Linux' end |
.name ⇒ Object Also known as: to_s
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/os-name.rb', line 6 def name case RbConfig::CONFIG['host_os'] when /linux/ 'Linux' when /darwin/ 'OS X' when /mswin|mingw32|windows/ 'Windows' when /solaris/ 'Solaris' when /bsd/ 'BSD' else RbConfig::CONFIG['host_os'] end end |
.osx? ⇒ Boolean
36 37 38 |
# File 'lib/os-name.rb', line 36 def osx? name == 'OS X' end |
.solaris? ⇒ Boolean
44 45 46 |
# File 'lib/os-name.rb', line 44 def solaris? name == 'Solaris' end |
.to_sym ⇒ Object Also known as: intern
26 27 28 |
# File 'lib/os-name.rb', line 26 def to_sym name.downcase.delete(' ').to_sym end |
.windows? ⇒ Boolean
40 41 42 |
# File 'lib/os-name.rb', line 40 def windows? name == 'Windows' end |