Class: Dev::Os
Overview
Class containing methods for determining operating system information
Instance Attribute Summary collapse
-
#os ⇒ Object
Returns the value of attribute os.
Instance Method Summary collapse
-
#cygwin? ⇒ Boolean
Returns true if the host_os contains cygwiny text.
-
#darwin? ⇒ Boolean
Returns true if the host_os contains darwinsy text.
-
#initialize ⇒ Os
constructor
A new instance of Os.
-
#mac? ⇒ Boolean
Returns true if the host_os contains macsy text.
-
#nix? ⇒ Boolean
Returns true if the host_os contains nixy text.
-
#windows? ⇒ Boolean
Returns true if the host_os contains windowsy text.
Constructor Details
#initialize ⇒ Os
Returns a new instance of Os.
6 7 8 |
# File 'lib/firespring_dev_commands/os.rb', line 6 def initialize @os = ::RbConfig::CONFIG['host_os'] end |
Instance Attribute Details
#os ⇒ Object
Returns the value of attribute os.
4 5 6 |
# File 'lib/firespring_dev_commands/os.rb', line 4 def os @os end |
Instance Method Details
#cygwin? ⇒ Boolean
Returns true if the host_os contains cygwiny text
31 32 33 |
# File 'lib/firespring_dev_commands/os.rb', line 31 def cygwin? os.match?(/(cygwin)/i) end |
#darwin? ⇒ Boolean
Returns true if the host_os contains darwinsy text
16 17 18 |
# File 'lib/firespring_dev_commands/os.rb', line 16 def darwin? os.match?(/(darwin|mac os)/i) end |
#mac? ⇒ Boolean
Returns true if the host_os contains macsy text
21 22 23 |
# File 'lib/firespring_dev_commands/os.rb', line 21 def mac? darwin? end |
#nix? ⇒ Boolean
Returns true if the host_os contains nixy text
26 27 28 |
# File 'lib/firespring_dev_commands/os.rb', line 26 def nix? os.match?(/(linux|bsd|aix|solaris)/i) end |
#windows? ⇒ Boolean
Returns true if the host_os contains windowsy text
11 12 13 |
# File 'lib/firespring_dev_commands/os.rb', line 11 def windows? os.match?(/(mingw|mswin|windows)/i) end |