Class: Dev::Os

Inherits:
Object show all
Defined in:
lib/firespring_dev_commands/os.rb

Overview

Class containing methods for determining operating system information

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOs

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

#osObject

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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


11
12
13
# File 'lib/firespring_dev_commands/os.rb', line 11

def windows?
  os.match?(/(mingw|mswin|windows)/i)
end