/flowgraph

Record call graphs from your Ruby code

Primary LanguageRubyMIT LicenseMIT

flowgraph

Simplifies recording and analyzing a call graph from your Ruby code.

Installation

Add this line to your application's Gemfile:

gem 'flowgraph'

And then execute:

$ bundle

Or install it yourself as:

$ gem install flowgraph

Usage

Generate a SQLite database containing a call graph for your Ruby code:

recorder = Flowgraph::Recorders::Sqlite.new("foo.sqlite3")
Flowgraph.trace(recorder) do
  # code to trace goes here
end

Or filter out code that doesn't exist inside your project root:

recorder = Flowgraph::Recorders::Filtered.only(sqlite_recorder, File.join(__dir__, ".."))

To simplify recording in tests, hooks are provided for popular test frameworks:

# For RSpec, `in spec/spec_helper.rb`:
Flowgraph::Hooks::RSpec.install_hook(recorder)

# ...or for Minitest, in `test/test_helper.rb`
Flowgraph::Hooks::Minitest.install_hook(recorder)

See the examples directory for examples of how to use this gem.

License

The gem is available as open source under the terms of the MIT License.