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

Constant Summary collapse

ATTRIBUTES_FOR_DISPLAY =
%w[name verb controller action path].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(route) ⇒ Route

Returns a new instance of Route.



11
12
13
# File 'lib/passages/route.rb', line 11

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

Class Method Details

.attributes_for_displayObject



16
17
18
# File 'lib/passages/route.rb', line 16

def attributes_for_display
  ATTRIBUTES_FOR_DISPLAY
end

.from_raw_route(raw_route) ⇒ Object



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

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