概要
pry でクラス階層を Ascii Art で出力する pry-aa_ancestors を作成しました。
※ オープンクラスと eval を使った evil な実装です
インストール
$ gem install pry-aa_ancestors
- インストールの確認
$ pry --plugins
Installed Plugins:
--
aa_ancestors Show the class hierarchy that is Ascii-Art format.
Help
$ pry
[1] pry(main)> help aa_ancestors
Show the class hierarchy that is Ascii-Art format.
-h, --help Show this message.
試用
Standard class ( String ) hierarchy
$ pry
[2] pry(main)> aa_ancestors String
-----------------
| BasicObject |
-----------------
|
-----------------
| Kernel |
-----------------
|
-----------------
|PP::ObjectMixin|
-----------------
|
-----------------
| Object |
-----------------
|
-----------------
| Comparable |
-----------------
|
-----------------
| String |
-----------------
User defined class ( Child ) hierarchy
% pry
[1] pry(main)> module Extendable
[1] pry(main)* end
=> nil
[2] pry(main)> class Parent
[2] pry(main)* end d
=> nil
[3] pry(main)> class Child < Parent
[3] pry(main)* include Extendable
[3] pry(main)* end d
=> Child
[4] pry(main)> aa_ancestors Child
-----------------
| BasicObject |
-----------------
|
-----------------
| Kernel |
-----------------
|
-----------------
|PP::ObjectMixin|
-----------------
|
-----------------
| Object |
-----------------
|
-----------------
| Parent |
-----------------
|
-----------------
| Extendable |
-----------------
|
-----------------
| Child |
-----------------