Skip to content

Commit

Permalink
Wrote visualize method
Browse files Browse the repository at this point in the history
  • Loading branch information
jtibbertsma committed Dec 18, 2015
1 parent a654689 commit 9a8b7a3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/router-visualizer/mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,22 @@ module ActionDispatch
module Routing
class Mapper
def visualize(options = {})
groups = options.delete(:groups) { ['development'] }
at = options.delete(:at) { '/routes' }

if matching_group? groups
mount RouterVisualizer::Engine, at: at
end
self
end

private
def matching_group?(groups)
groups.each do |group|
return true if Rails.env.send("#{group}?")
end
false
end
end
end
end

0 comments on commit 9a8b7a3

Please sign in to comment.