Sha256: 49e2bd649d20abaef526d2871c4be51878a4cb449a3304a9c1e9c5e9cf47bb54

Contents?: true

Size: 542 Bytes

Versions: 3

Compression:

Stored size: 542 Bytes

Contents

module Crystal
  module Routes
    class Configurator
      def initialize router
        @router = router
      end      
      
      def named_route *args, &block
        named_router = @router.routes[:named_router]
        raise "There's no NamedRouter (use config to add it)!" unless named_router
        named_router.add *args, &block
      end
      
      class << self
        inject :router => :router
        
        def routes &block
          block.call Configurator.new(router)
        end          
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
crystal-0.0.13 lib/crystal/router/configurator.rb
crystal-0.0.12 lib/crystal/router/configurator.rb
crystal_ext-0.0.11 lib/crystal/router/configurator.rb