Module: NeetoCommonsBackend::Routes

Defined in:
lib/neeto_commons_backend/routes/draw.rb

Class Method Summary collapse

Class Method Details

.commons_routes(routes_name) ⇒ Object



14
15
16
# File 'lib/neeto_commons_backend/routes/draw.rb', line 14

def commons_routes(routes_name)
  "#{File.dirname(__FILE__)}/#{routes_name}.rb"
end

.draw(routes_name) ⇒ Object



6
7
8
# File 'lib/neeto_commons_backend/routes/draw.rb', line 6

def draw(routes_name)
  load_draw(routes_name)
end

.load_draw(routes_name) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/neeto_commons_backend/routes/draw.rb', line 18

def load_draw(routes_name)
  if File.exist?(neeto_routes(routes_name))
    Rails.application.routes.draw do
      instance_eval(File.read(NeetoCommonsBackend::Routes.neeto_routes(routes_name)))
    end
  else
    instance_eval(File.read(commons_routes(routes_name)))
  end
end

.neeto_routes(routes_name) ⇒ Object



10
11
12
# File 'lib/neeto_commons_backend/routes/draw.rb', line 10

def neeto_routes(routes_name)
  Rails.root.join("config/routes/#{routes_name}.rb")
end