Class: StrongRoutes::RouteMapper
- Inherits:
-
Object
- Object
- StrongRoutes::RouteMapper
- Defined in:
- lib/strong_routes/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
10 11 12 |
# File 'lib/strong_routes/route_mapper.rb', line 10 def initialize(route_set) @route_set = route_set end |
Instance Attribute Details
#route_set ⇒ Object (readonly)
Returns the value of attribute route_set.
3 4 5 |
# File 'lib/strong_routes/route_mapper.rb', line 3 def route_set @route_set end |
Class Method Details
.map(route_set) ⇒ Object
5 6 7 8 |
# File 'lib/strong_routes/route_mapper.rb', line 5 def self.map(route_set) route_mapper = new(route_set) route_mapper.map end |
Instance Method Details
#map ⇒ Object
Map the route set to a collection of the top level segments.
15 16 17 18 19 |
# File 'lib/strong_routes/route_mapper.rb', line 15 def map map = matches.map { |match_data| match_data[:path] } map.uniq! map end |