Class: StrongRoutes::Rails::RouteMapper
- Inherits:
-
Object
- Object
- StrongRoutes::Rails::RouteMapper
- Defined in:
- lib/strong_routes/rails/route_mapper.rb
Instance Attribute Summary collapse
-
#route_set ⇒ Object
readonly
Returns the value of attribute route_set.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(route_set) ⇒ RouteMapper
constructor
A new instance of RouteMapper.
-
#map ⇒ Object
Map the route set to a collection of the top level segments.
Constructor Details
#initialize(route_set) ⇒ RouteMapper
Returns a new instance of RouteMapper.
13 14 15 |
# File 'lib/strong_routes/rails/route_mapper.rb', line 13 def initialize(route_set) @route_set = route_set end |
Instance Attribute Details
#route_set ⇒ Object (readonly)
Returns the value of attribute route_set.
6 7 8 |
# File 'lib/strong_routes/rails/route_mapper.rb', line 6 def route_set @route_set end |
Class Method Details
.map(route_set) ⇒ Object
8 9 10 11 |
# File 'lib/strong_routes/rails/route_mapper.rb', line 8 def self.map(route_set) route_mapper = self.new(route_set) route_mapper.map end |
Instance Method Details
#map ⇒ Object
Map the route set to a collection of the top level segments.
18 19 20 21 22 23 |
# File 'lib/strong_routes/rails/route_mapper.rb', line 18 def map map = matches.map { |match_data| match_data[:path] } map.compact! map.uniq! map end |