From 37a4a28deec224f7cd9a5a124e22258e868913e4 Mon Sep 17 00:00:00 2001 From: Gibheer Date: Mon, 26 Nov 2012 21:40:21 +0100 Subject: added the first set of documentation --- doc/Zero/Controller.html | 616 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 616 insertions(+) create mode 100644 doc/Zero/Controller.html (limited to 'doc/Zero/Controller.html') diff --git a/doc/Zero/Controller.html b/doc/Zero/Controller.html new file mode 100644 index 0000000..a4e6a0c --- /dev/null +++ b/doc/Zero/Controller.html @@ -0,0 +1,616 @@ + + + + + + Class: Zero::Controller + + — Documentation by YARD 0.8.3 + + + + + + + + + + + + + + + + + + + + + +

Class: Zero::Controller + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/zero/controller.rb
+ +
+
+ +

Overview

+
+ +

abstract class to make creation of controllers easier

+ +

This abstract class creates an interface to make it easier to write rack +compatible controllers. It catches #call and creates a new instance with +the environment and calls #render on it.

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + (collapse) +

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Controller) initialize(request) + + + + + +

+
+ +

initialize the controller

+ + +
+
+
+

Parameters:

+
    + +
  • + + request + + + (Request) + + + + — +
    +

    a request object

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+30
+31
+32
+33
+
+
# File 'lib/zero/controller.rb', line 30
+
+def initialize(request)
+  @request  = request
+  @response = Zero::Response.new
+end
+
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + + (Object) call(env) + + + + + +

+
+ +

initialize a new instance of the controller and call response on it

+ + +
+
+
+ + +
+ + + + +
+
+
+
+9
+10
+11
+
+
# File 'lib/zero/controller.rb', line 9
+
+def self.call(env)
+  new(Zero::Request.new(env)).response
+end
+
+
+
+ +
+

+ + + (Object) renderer + + + + + +

+
+ +

get the renderer set in the controller

+ + +
+
+
+ + +
+ + + + +
+
+
+
+19
+20
+21
+
+
# File 'lib/zero/controller.rb', line 19
+
+def self.renderer
+  @@renderer
+end
+
+
+
+ +
+

+ + + (Object) renderer=(renderer) + + + + + +

+
+ +

set the renderer to use in the controller

+ + +
+
+
+ + +
+ + + + +
+
+
+
+14
+15
+16
+
+
# File 'lib/zero/controller.rb', line 14
+
+def self.renderer=(renderer)
+  @@renderer = renderer
+end
+
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + - (Object) renderer + + + + + +

+
+ +

a small helper to get the actual renderer

+ + +
+
+
+ + +
+ + + + +
+
+
+
+24
+25
+26
+
+
# File 'lib/zero/controller.rb', line 24
+
+def renderer
+  self.class.renderer
+end
+
+
+
+ +
+

+ + - (Object) response + + + + + +

+
+ +

build the response and return it

+ +

This method calls #process if it was defined so make it easier to process +the request before rendering stuff.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + + + + + +
    +

    Response a rack conform response

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+40
+41
+42
+43
+44
+
+
# File 'lib/zero/controller.rb', line 40
+
+def response
+  process if respond_to?(:process)
+  render
+  @response.to_a
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file -- cgit v1.2.3-70-g09d2