Sha256: 71b2e78df782c3a1f5a5cfc8b7911aa893388ade8b2a872adc0764ea20121e50

Contents?: true

Size: 659 Bytes

Versions: 3

Compression:

Stored size: 659 Bytes

Contents

module Crystal
  module Processors
    class Router < Processor
      inject :router => :router
      
      def initialize next_processor, class_variable = 'class', method_variable = 'method'
        super(next_processor)
        @class_variable, @method_variable = class_variable, method_variable
      end
      
      def call
        klass, method, params = router.decode workspace.path, workspace.params
        
        # params.class_name, params.method_name = klass.name, method

        workspace[@class_variable], workspace[@method_variable], workspace.params = klass, method, params
        
        next_processor.call
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

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