Sha256: c7c3891a248397fe71d3d0ce7f1529c35efd5b8aaa855836eb950975df8a8e33

Contents?: true

Size: 720 Bytes

Versions: 21

Compression:

Stored size: 720 Bytes

Contents

# frozen_string_literal: true

module NeetoCommonsBackend
  module Routes
    class << self
      def draw(routes_name)
        load_draw(routes_name)
      end

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

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

      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
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
neeto-commons-backend-1.0.109 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.108 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.107 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.106 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.105 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.104 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.103 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.102 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.101 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.100 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.99 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.98 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.97 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.96 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.95 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.94 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.93 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.92 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.91 lib/neeto_commons_backend/routes/draw.rb
neeto-commons-backend-1.0.90 lib/neeto_commons_backend/routes/draw.rb