Module: OS

Instance Method Summary collapse

Instance Method Details

#mac?Boolean

Returns:

  • (Boolean)


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/mobmanager/mobile/os/os.rb', line 2

def mac?
  begin
    os = %x[sw_vers -productName]
  rescue Exception
    os = nil
  end
  if os.nil?
    return false if %x[ver].to_s.downcase.include? 'windows'
  elsif os
    return true if %[sw_vers -productName].to_s.downcase.include? 'mac'
  else
    fail '[PANIC:] Failed to determine OS.'
    return false
  end
  true
end