LoginSignup
8
8

More than 5 years have passed since last update.

Ruby Gviz gemでRailsの処理フローを描いてみる

Posted at

Gvizが面白そうだったので、(うちの)Ruby on RailsのWEBサービスでの処理イメージを描いてみます。
※厳密なRailsの動作ではなく、コーディング時に見る流れをざっくり抽象化したものです。

MacでGvizを入れる方法

bash
$ brew update
$ brew install gts
$ brew install graphviz
$ gem install gviz

ソース

sample.rb
require 'gviz'

Graph do
  global label: 'Ruby on Rails 処理イメージ'
  #Browser
  route :browser => :httpRequest
  route :httpRequest => :ruby
  route :httpResponse => :browser

  #Vies
  subgraph do
    global label: 'Views', bgcolor: :floralwhite
    route :yml => :html
    route :scss => :css
    route :bootstrap => :scss
    route :coffeeScript => :javaScript
    route :jQuery => :javaScript
    route :erb => :html
    route :haml => :erb
    route :javaScript => :httpResponseData
    route :css => :httpResponseData
    route :html => :httpResponseData
  end

  #Controllers
  subgraph do
    global label: 'Controllers', bgcolor: :azure
    route :httpResponseData => :ruby
    route :ruby => [:haml, :httpResponse]
  end

  #model
  subgraph do
    global label: 'Model', bgcolor: :palegreen
    route :ruby => :activeRecord
    route :mySQL => :activeRecord
    route :activeRecord => [:ruby, :mySQL]
  end

  save :sample, :png
end

出力画像(sample.png)

sample.png

※技術総称・ライブラリ・フレームワーク名や関係性が入り混じっていますが、あくまでざっくりイメージです…。

8
8
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
8
8