Render Ruby object to interactive html
- by AvImd
I am developing a tool that discovers network services enabled on host and writes short summary on them like this:
init,1
+-- login,1560 --
+-- bash,1629
+-- nc,12137 -lup 50505
{
:net = [
[0] "*:50505 IPv4 UDP "
],
:fds = [
[0] "/root (cwd)",
[1] "/",
[2] "/bin/nc.traditional",
[3] "/xochikit/ld_poison.so (stat: No such file or directory)",
[4] "/dev/tty2",
[5] "*:50505"
]
}
It proved to be very nice formatted and useful for quick discovery thanks to colors provided by the awesome_print gem. However, its output is just a text. One issue is that if I want to share it, I lose colors. I'd also like to fold and unfold parts of objects, quickly jump to specific processes and what not? Adding comments, for example. Thus I want something web-based.
What is the best approach to implement features like these? I haven't worked with web interfaces before and I don't have much experience with Ruby.