1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#!/usr/bin/env ruby while line = STDIN.gets a = line.split d = {} a.each { |i| name, val = i.split("::") if name == "temperature" d["temperature"] = val end if name == "device_id" d["dev"] = val end } puts d.to_s end