Class: Lotus::Routing::Resource Private
- Inherits:
-
Object
- Object
- Lotus::Routing::Resource
- Includes:
- Utils::ClassAttribute
- Defined in:
- lib/lotus/routing/resource.rb,
lib/lotus/routing/resource/action.rb,
lib/lotus/routing/resource/nested.rb,
lib/lotus/routing/resource/options.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Set of RESTful resource routes Implementation of Lotus::Router#resource
Direct Known Subclasses
Defined Under Namespace
Modules: DefaultMemberAction Classes: Action, CollectionAction, Create, Destroy, Edit, MemberAction, Nested, New, Options, Show, Update
Constant Summary collapse
- NESTED_ROUTES_SEPARATOR =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'/'.freeze
Instance Attribute Summary collapse
- #parent ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(router, name, options = {}, parent = nil, &blk) ⇒ Resource
constructor
private
A new instance of Resource.
-
#resource(name, options = {}, &blk) ⇒ Object
private
Allow nested resource inside resource or resources.
-
#resources(name, options = {}, &blk) ⇒ Object
private
Allow nested resources inside resource or resources.
-
#wildcard_param(route_param = nil) ⇒ Object
private
Return separator.
Constructor Details
#initialize(router, name, options = {}, parent = nil, &blk) ⇒ Resource
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Resource.
56 57 58 59 60 61 62 |
# File 'lib/lotus/routing/resource.rb', line 56 def initialize(router, name, = {}, parent = nil, &blk) @router = router @name = name @parent = parent @options = Options.new(self.class.actions, .merge(name: @name)) generate(&blk) end |
Instance Attribute Details
#parent ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
52 53 54 |
# File 'lib/lotus/routing/resource.rb', line 52 def parent @parent end |
Instance Method Details
#resource(name, options = {}, &blk) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Allow nested resource inside resource or resources
78 79 80 |
# File 'lib/lotus/routing/resource.rb', line 78 def resource(name, = {}, &blk) _resource(Resource, name, , &blk) end |
#resources(name, options = {}, &blk) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Allow nested resources inside resource or resources
69 70 71 |
# File 'lib/lotus/routing/resource.rb', line 69 def resources(name, = {}, &blk) _resource(Resources, name, , &blk) end |
#wildcard_param(route_param = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return separator
86 87 88 |
# File 'lib/lotus/routing/resource.rb', line 86 def wildcard_param(route_param = nil) NESTED_ROUTES_SEPARATOR end |