鉴于dmidecode
解析的dmidecode红宝石
Handle 0x0025, DMI type 13, 22 bytes
BIOS Language Information
Installable Languages: 1
en|US|iso8859-1
Currently Installed Language: en|US|iso8859-1
Handle 0x0026, DMI type 16, 15 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: Single-bit ECC
Maximum Capacity: 16 GB
Error Information Handle: Not Provided
Number Of Devices: 4
输出现在我正在寻找一个正则表达式/红宝石组合或别的东西来获得类似于
{ "BIOS Language Information" =>
{ "Installable Languages" => "1\n en|US|iso8859-1",
"Currently Installed Language" => "en|US|iso8859-1"},
"Physical Memory Array" =>
{ "Location" => "System Board Or Motherboard",
"Use" => "System Memory"} }
的数据结构你可以使用'StringScanner'和正则表达式来标记它,并从那里工作 – NullUserException 2010-09-21 14:10:06