Class: StaticRoutes

Inherits:
Object
  • Object
show all
Defined in:
lib/static_routes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#contextObject

Returns the value of attribute context.



4
5
6
# File 'lib/static_routes.rb', line 4

def context
  @context
end

#limitsObject

Returns the value of attribute limits.



4
5
6
# File 'lib/static_routes.rb', line 4

def limits
  @limits
end

#prefixed_modulesObject

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