Class: Para::Routes
- Inherits:
-
Object
- Object
- Para::Routes
- Defined in:
- lib/para/routes.rb
Instance Attribute Summary collapse
-
#router ⇒ Object
readonly
Returns the value of attribute router.
Class Method Summary collapse
Instance Method Summary collapse
- #draw(mount_location = '/', &block) ⇒ Object
-
#initialize(router) ⇒ Routes
constructor
A new instance of Routes.
Constructor Details
#initialize(router) ⇒ Routes
Returns a new instance of Routes.
7 8 9 |
# File 'lib/para/routes.rb', line 7 def initialize(router) @router = router end |
Instance Attribute Details
#router ⇒ Object (readonly)
Returns the value of attribute router.
5 6 7 |
# File 'lib/para/routes.rb', line 5 def router @router end |
Class Method Details
.extend_routes_for(component_type, &block) ⇒ Object
31 32 33 34 |
# File 'lib/para/routes.rb', line 31 def self.extend_routes_for(component_type, &block) extensions = routes_extensions_for(component_type) extensions << block end |
.routes_extensions_for(component_type) ⇒ Object
36 37 38 39 |
# File 'lib/para/routes.rb', line 36 def self.routes_extensions_for(component_type) self.routes_extensions ||= {} self.routes_extensions[component_type] ||= [] end |
Instance Method Details
#draw(mount_location = '/', &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/para/routes.rb', line 11 def draw(mount_location = '/', &block) router.instance_eval do scope mount_location do scope module: :para do namespace :admin do get '/' => 'main#index' get '/search' => 'search#index', as: :search end # Components are namespaced into :admin in their respective methods crud_component scoped_in_para: true form_component scoped_in_para: true component :settings, scoped_in_para: true end block.call if block end end end |