Class: Passages::Route

Inherits:
ActionDispatch::Routing::RouteWrapper
  • Object
show all
Defined in:
lib/passages/route.rb

Overview

Main DelegateClass used for decoration and discerning if a route is

a "regular" route or a mount route

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(route) ⇒ Route

Returns a new instance of Route.



9
10
11
# File 'lib/passages/route.rb', line 9

def initialize(route)
  super(ActionDispatch::Routing::RouteWrapper.new(route))
end

Class Method Details

.attributes_for_displayObject



14
15
16
# File 'lib/passages/route.rb', line 14

def attributes_for_display
  %w(name verb controller action path)
end

.from_raw_route(raw_route) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/passages/route.rb', line 18

def from_raw_route(raw_route)
  mount_class = mount_route_class(raw_route)

  if mount_class.nil?
    new(raw_route)
  else
    MountRoute.new(raw_route, mount_class)
  end
end