vitoravelino/modular_routes

View on GitHub
lib/modular_routes/scopable.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module ModularRoutes
  module Scopable
    def self.for(type, *args)
      case type
      when :namespace then Namespace.new(*args)
      when :resources then Resource.new(*args)
      when :resource then SingleResource.new(*args)
      when :scope then Scope.new(*args)
      when :concern then Concern.new(*args)
      else raise NotImplementedError
      end
    end
  end
end