Method: VirtualBox::Vm.parse_machine_readable
- Defined in:
- lib/virtual_box/vm.rb
.parse_machine_readable(output) ⇒ Hash<String, Object>
Parses the output of the ‘VBoxManage showvminfo –machinereadable’ command.
290 291 292 293 294 295 296 297 |
# File 'lib/virtual_box/vm.rb', line 290 def self.parse_machine_readable(output) Hash[output.split("\n").map { |line| key, value = *line.split('=', 2) key = key[1...-1] if key[0] == ?" # Remove string quotes (""). value = value[1...-1] if value[0] == ?" # Remove string quotes (""). [key, value] }] end |