[dmdevices] Rewrite in ruby