JavaでRubyのpもどきを実装してみた

スーパーリフレクティングターイム


qnighy's
gist: 145639 — Gist

以下のようにつかう。

import java.util.HashMap;
import static org.acikelabo.RubyInspect.p;


public class Test {

	public static void main(String[] args) {
		HashMap<String, Integer> map = new HashMap<String, Integer>();
		map.put("test", 4);
		Object[] objs = new Object[] {null, map, "Hello, world!", 10};
		objs[0] = objs;
		p(objs);
	}

}
[..., {"test" => 4}, "Hello, world!", 10]

いちおう拡張できるようになってる。