@ledsun blog

無味の味は佳境に入らざればすなわち知れず

ActiveRecordを継承したクラスのmermaid.jsクラス図を作るワンライナー

curl https://gist.githubusercontent.com/ledsun/76d5485644685f19c98f88000a971d00/raw/a1aa3df955ee8829b7041c1c6cda11610978d393/class_diagram.rb
 | bin/rails runner - Computer

実行すると次の感じです。

~ curl https://gist.githubusercontent.com/ledsun/76d5485644685f19c98f88000a971d00/raw/a1aa3df955ee8829b7041c1c6cda11610978d393/class_diagram.rb | bin/rails runner - Computer
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   867  100   867    0     0  12092      0 --:--:-- --:--:-- --:--:-- 12211
Running via Spring preloader in process 13045
classDiagram
class Computer {
   integer id
    string user_name
    string maker
    string memory
   integer release_year
  datetime created_at
  datetime updated_at
}

正体は、以前作った ActiveRecordを継承したクラスからUMLクラス図をMermaid.jsで作る - @ledsun blog をgistに置いただけです。