2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ฅ(・ω・ฅ){ pry でクラス階層を Ascii Art で出力する pry-aa_ancestors を作成した } #pry

Last updated at Posted at 2015-02-17

:musical_score: 概要

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.

:closed_book: Help

$ pry
[1] pry(main)> help aa_ancestors
Show the class hierarchy that is Ascii-Art format.
    -h, --help      Show this message.

試用

:older_man::man::boy::baby: Standard class ( String ) hierarchy

$ pry
[2] pry(main)> aa_ancestors String
-----------------
|  BasicObject  |
-----------------
       |
-----------------
|    Kernel     |
-----------------
       |
-----------------
|PP::ObjectMixin|
-----------------
       |
-----------------
|    Object     |
-----------------
       |
-----------------
|  Comparable   |
-----------------
       |
-----------------
|    String     |
-----------------

:older_woman::woman::girl::baby: 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     |
-----------------

:books: 外部資料

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?