Class: Perron::Site::Builder::Paths
- Inherits:
-
Object
- Object
- Perron::Site::Builder::Paths
- Defined in:
- lib/perron/site/builder/paths.rb
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(collection, paths) ⇒ Paths
constructor
A new instance of Paths.
Constructor Details
#initialize(collection, paths) ⇒ Paths
Returns a new instance of Paths.
7 8 9 |
# File 'lib/perron/site/builder/paths.rb', line 7 def initialize(collection, paths) @collection, @paths = collection, paths end |
Instance Method Details
#get ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/perron/site/builder/paths.rb', line 11 def get @paths << routes.public_send(index_path) if routes.respond_to?(index_path) if routes.respond_to?(show_path) @collection.all.each do |resource| root = resource.slug == "/" next if skip? root @paths << (root ? routes.root_path : routes.public_send(show_path, resource)) (resource.class.try(:nested_routes) || []).each do |nested| @paths << routes.polymorphic_path([resource, nested]) end end end end |