Class: Crystal::Processors::Router

Inherits:
Crystal::Processor show all
Defined in:
lib/crystal/router/processors/router.rb

Instance Attribute Summary

Attributes inherited from Crystal::Processor

#next_processor

Instance Method Summary collapse

Methods inherited from Crystal::Processor

inspect

Constructor Details

#initialize(next_processor, class_variable = 'class', method_variable = 'method') ⇒ Router

Returns a new instance of Router.



6
7
8
9
# File 'lib/crystal/router/processors/router.rb', line 6

def initialize next_processor, class_variable = 'class', method_variable = 'method'
  super(next_processor)
  @class_variable, @method_variable = class_variable, method_variable
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
# File 'lib/crystal/router/processors/router.rb', line 11

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