Class: Waves::ResponseProxy

Inherits:
Object show all
Includes:
ResponseMixin
Defined in:
lib/runtime/response_proxy.rb

Overview

Mapping actions are evaluated in the context of a ResponseProxy.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ResponseMixin

#blackboard, #controllers, #domain, #log, #models, #not_found, #params, #path, #response, #session, #url, #views

Constructor Details

#initialize(request) ⇒ ResponseProxy

Returns a new instance of ResponseProxy.



10
11
12
# File 'lib/runtime/response_proxy.rb', line 10

def initialize(request)
  @request = request
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



6
7
8
# File 'lib/runtime/response_proxy.rb', line 6

def request
  @request
end

Instance Method Details

#controller(&block) ⇒ Object



18
19
20
# File 'lib/runtime/response_proxy.rb', line 18

def controller( &block )
  lambda { Waves.application.controllers[ @resource ].process( @request, &block ) }
end

#redirect(path, status = '302') ⇒ Object



26
# File 'lib/runtime/response_proxy.rb', line 26

def redirect(path, status = '302'); @request.redirect(path, status); end

#resource(resource, &block) ⇒ Object



14
15
16
# File 'lib/runtime/response_proxy.rb', line 14

def resource( resource, &block )
  @resource = resource; yield.call
end

#view(&block) ⇒ Object



22
23
24
# File 'lib/runtime/response_proxy.rb', line 22

def view( &block )
  lambda { |val| Waves.application.views[ @resource ].process( @request, val, &block ) }
end