Class: StaticRoutes
- Inherits:
-
Object
- Object
- StaticRoutes
- Defined in:
- lib/static_routes.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#limits ⇒ Object
Returns the value of attribute limits.
-
#prefixed_modules ⇒ Object
Returns the value of attribute prefixed_modules.
Instance Method Summary collapse
- #for(attributes) ⇒ Object
-
#initialize(attributes = {}) ⇒ StaticRoutes
constructor
A new instance of StaticRoutes.
Constructor Details
#initialize(attributes = {}) ⇒ StaticRoutes
Returns a new instance of StaticRoutes.
5 6 7 8 |
# File 'lib/static_routes.rb', line 5 def initialize(attributes = {}) @context = attributes[:context] @limits = {} end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
4 5 6 |
# File 'lib/static_routes.rb', line 4 def context @context end |
#limits ⇒ Object
Returns the value of attribute limits.
4 5 6 |
# File 'lib/static_routes.rb', line 4 def limits @limits end |
#prefixed_modules ⇒ Object
Returns the value of attribute prefixed_modules.
4 5 6 |
# File 'lib/static_routes.rb', line 4 def prefixed_modules @prefixed_modules end |
Instance Method Details
#for(attributes) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/static_routes.rb', line 10 def for(attributes) splice_limits(attributes[:arguments]) self.prefixed_modules = attributes[:prefixed_modules]&.split('/') || [] attributes[:arguments].each do |controller| write_routes_for(controller) end end |