Module: Hypervisor::Framework

Extended by:
FFI::Library
Defined in:
lib/hypervisor/framework.rb

Class Method Summary collapse

Class Method Details

.return_t(result) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/hypervisor/framework.rb', line 39

def self.return_t(result)
  unless result == 0
    case result
    when SUCCESS
      return
    when ERROR
      raise "Error"
    when BUSY
      raise "Busy"
    when BAD_ARGUMENT
      raise "Bad Argument"
    when NO_RESOURCES
      raise "No Resources"
    when NO_DEVICE
      raise "No Device"
    when UNSUPPORTED
      raise "Hypervisor.framework is not supported on your computer"
    else
      raise "Something went wrong #{result}"
    end
  end
end