2006年 10月 30日

Battery

info = eval( `ioreg -w0 -l | grep LegacyBatteryInfo`.gsub(/=/, '=>').gsub(/^.*¥{/, '{') )

percentage = info["Current"].to_f / info["Capacity"] * 100
puts percentage