Class: Ramaze::Dispatcher::Action

Inherits:
Object
  • Object
show all
Extended by:
Trinity
Defined in:
lib/ramaze/dispatcher/action.rb

Overview

This dispatcher is responsible for relaying requests to Controller::handle and filtering the results using FILTER.

Constant Summary collapse

FILTER =

The response is passed to each filter by sending .call(response) to it.

OrderedSet.new(
  # Ramaze::Tool::Localize,
)

Class Method Summary collapse

Class Method Details

.call(path) ⇒ Object

Takes path, asks Controller to handle it and builds a response on success. The response is then passed to each member of FILTER for post-processing.



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/ramaze/dispatcher/action.rb', line 25

def call(path)
  Log.info("Dynamic request from #{request.ip}: #{request.request_uri}")

  catch(:respond) {
    body = Controller.handle(path)
    Response.current.build(body)
  }

  FILTER.each{|f| f.call(response)}
  response
rescue Ramaze::Error => ex
  ex
end