lib/para/routes.rb in para-0.5.1 vs lib/para/routes.rb in para-0.5.3

- old
+ new

@@ -1,7 +1,9 @@ module Para class Routes + class_attribute :routes_extensions + attr_reader :router def initialize(router) @router = router end @@ -13,14 +15,25 @@ namespace :admin do get '/' => 'main#index' crud_component :crud, scope: ':model' singleton_resource_component :singleton, scope: ':model' + component :settings end end block.call if block end end + end + + def self.extend_routes_for(component_type, &block) + extensions = routes_extensions_for(component_type) + extensions << block + end + + def self.routes_extensions_for(component_type) + self.routes_extensions ||= {} + self.routes_extensions[component_type] ||= [] end end end