# Rails Router Visualizer

This gem allows you to see a visualization of the router of your Rails application.

This visualization is generated by the Rails router itself. Calling `Rails.application.routes.router.visualizer` from your application will return the text of an html file titled "Routes FSM with NFA simulation". This gem just wraps this functionality into a simple engine that you can mount at some route.

The visualizer also shows a list of all of your application's routes. It doesn't list the REST methods associated with the routes.

## Installation

Add the gem to your app's development environment and run the `bundle` command to install it.

```ruby
gem 'router-visualizer', group: :development
```

## Requirements

For this to work, you need the `dot` command. This command is used for drawing directed graphs; this is what Rails uses to generate the visualization of the router NFA.

If you're on OS X, you can do

```bash
$ brew install gprof2dot
```

## Usage

```ruby
# config/routes.rb

Rails.application.routes.draw do
  # ...

  if Rails.env.development?
    mount RouterVisualizer::Engine, at: "/routes"
  end

  # ...
end
```

Then you can navigate to `localhost:3000/routes` to see the visualization.

## What is the point of this?

I want to learn to write gems and rails engines. This is a simple starting point.
# Rails Router Visualizer

This gem allows you to see a visualization of the router of your Rails 4 application.

This visualization is generated by the Rails Journey router. It was written by [tenderlove](http://tenderlove.github.io) back before Journey was incorporated into Rails. Calling `Rails.application.routes.router.visualizer` from your application will return the text of an html file titled "Routes FSM with NFA simulation". This gem just wraps this functionality into a simple engine that you can mount at some route.

The visualizer also shows a list of all of your application's routes. It doesn't list the REST methods associated with the routes.

## Installation

Add the gem to your app's development environment and run the `bundle` command to install it.

```ruby
gem 'router-visualizer', group: :development
```

## Requirements

For this to work, you need the `dot` command. This command is used for drawing directed graphs; this is what Rails uses to generate the visualization of the router NFA.

If you're on OS X, you can do

```bash
$ brew install gprof2dot
```

## Usage

```ruby
# config/routes.rb

Rails.application.routes.draw do
  # ...

  if Rails.env.development?
    mount RouterVisualizer::Engine, at: "/routes"
  end

  # ...
end
```

Then you can navigate to `localhost:3000/routes` to see the visualization.

## What is the point of this?

I want to learn to write gems and rails engines. This is a simple starting point.
Add note about the author of the visualization
Add note about the author of the visualization
