nit
nit copied to clipboard
A simple quick-and-dirty poor man's object inspector.
Since Nit does not have introspection facilities, this module uses the serialization framework to inspect objects. A plain webserver is used to present the inspection interface. Feature:
To launch the object inspector, just call Serializable::http_inspect.
import serialization
Class A
serialize
var name: String
end
class B
serialize
var data: Int
var a: A
end
var a = new A("my_a")
var b = new B(42, a)
b.http_inspect
Anti-features:
- only serialized things from Serializable objects are exposed.
- crappy UI (plain HTML 2.0)
- crappy UI invocation (web server on localhost:8080 then
xdg-open http://localhost:8080) - no clean terminaison (just Ctrl-C)
crappy UI (plain HTML 2.0)
Then, where is the doctype (<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">)? Without doctype, it is “HTML 5 in quirks mode”. 😄