Render Ruby object to interactive html
Posted
by
AvImd
on Programmers
See other posts from Programmers
or by AvImd
Published on 2012-11-27T20:10:24Z
Indexed on
2012/11/27
23:28 UTC
Read the original article
Hit count: 456
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.
© Programmers or respective owner