Module: MachineGun::OS

Defined in:
lib/machine-gun/os.rb

Class Method Summary collapse

Class Method Details

.archObject



21
22
23
# File 'lib/machine-gun/os.rb', line 21

def arch
  platform.split('-')[0]
end

.hostObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/machine-gun/os.rb', line 8

def host
  h = platform.split('-')[1]

  case
  when h =~ /darwin/
    'darwin'
  when h =~ /linux/
    'linux'
  else
    'unknown'
  end
end

.linux?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/machine-gun/os.rb', line 29

def linux?
  host =~ /linux/i
end

.mac?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/machine-gun/os.rb', line 25

def mac?
  host =~ /darwin/i
end

.platformObject



4
5
6
# File 'lib/machine-gun/os.rb', line 4

def platform
  RUBY_PLATFORM
end