Class: StaticRoutes

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

Overview

get all seperate modules + controller

join by

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ StaticRoutes

Returns a new instance of StaticRoutes.



7
8
9
10
# File 'lib/static_routes.rb', line 7

def initialize(attributes = {})
  @context = attributes[:context]
  @limits = {}
end

Instance Attribute Details

#context ⇒ Object

Returns the value of attribute context.



6
7
8
# File 'lib/static_routes.rb', line 6

def context
  @context
end

#limits ⇒ Object

Returns the value of attribute limits.



6
7
8
# File 'lib/static_routes.rb', line 6

def limits
  @limits
end

#prefixed_modules ⇒ Object

Returns the value of attribute prefixed_modules.



6
7
8
# File 'lib/static_routes.rb', line 6

def prefixed_modules
  @prefixed_modules
end

Instance Method Details

#for(attributes) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/static_routes.rb', line 12

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