From 7578cb9adb72b8761731a819b0c92327ae99cd62 Mon Sep 17 00:00:00 2001 From: Gibheer Date: Tue, 27 Nov 2012 06:41:09 +0100 Subject: Revert "added the first set of documentation" This reverts commit 37a4a28deec224f7cd9a5a124e22258e868913e4. --- doc/Zero/Renderer.html | 654 ------------------------------------------------- 1 file changed, 654 deletions(-) delete mode 100644 doc/Zero/Renderer.html (limited to 'doc/Zero/Renderer.html') diff --git a/doc/Zero/Renderer.html b/doc/Zero/Renderer.html deleted file mode 100644 index 4ce1cee..0000000 --- a/doc/Zero/Renderer.html +++ /dev/null @@ -1,654 +0,0 @@ - - - - - - Class: Zero::Renderer - - — Documentation by YARD 0.8.3 - - - - - - - - - - - - - - - - - - - - - -

Class: Zero::Renderer - - - -

- -
- -
Inherits:
-
- Object - -
    -
  • Object
  • - - - -
- show all - -
- - - - - - - - - -
Defined in:
-
lib/zero/renderer.rb
- -
-
- -

Overview

-
- -

This class helps with rendering of content.

- -

The purpose of this class is to render templates. All variables pushed into -the renderer should be already processed, so that the raw data can be used.

- -

The workflow of this class is like the following.

-
  • -

    setup the type mapping

    -
  • -

    create a new instance of the class to prepare rendering

    -
  • -

    call #render to process the template

    -
- -

The call to #render will return the String representation of the template -with all data given.

- - -
-
-
- - -
- - - - - - - -

- Class Method Summary - (collapse) -

- - - -

- Instance Method Summary - (collapse) -

- - - - -
-

Constructor Details

- -
-

- - - (Renderer) initialize(path, context, accept_types) - - - - - -

-
- -

take the path and render the template within the context

- - -
-
-
-

Parameters:

-
    - -
  • - - path - - - (String) - - - - — -
    -

    the relative path to the template

    -
    - -
  • - -
  • - - context - - - (Object) - - - - — -
    -

    the object to process on

    -
    - -
  • - -
  • - - accept_types - - - - - - -
  • - -
- - -
- - - - -
-
-
-
-49
-50
-51
-52
-53
-
-
# File 'lib/zero/renderer.rb', line 49
-
-def initialize(path, context, accept_types)
-  accept_types ||= Request::Accept.new('text/html')
-  @path    = find_template(path, accept_types)
-  @context = context
-end
-
-
-
- -
- - -
-

Class Method Details

- - -
-

- - + (Object) template_path=(path) - - - - - -

-
- -

set a base path for template search

- - -
-
-
-

Parameters:

-
    - -
  • - - path - - - (String) - - - - — -
    -

    the path to the template base dir

    -
    - -
  • - -
- - -
- - - - -
-
-
-
-20
-21
-22
-
-
# File 'lib/zero/renderer.rb', line 20
-
-def template_path=(path)
-  @@path = path + '/'
-end
-
-
-
- -
-

- - + (Hash) type_map - - - - - -

-
- -

returns the type map

- - -
-
-
- -

Returns:

-
    - -
  • - - - (Hash) - - - - — -
    -

    the mapping for types

    -
    - -
  • - -
- -
- - - - -
-
-
-
-40
-41
-42
-
-
# File 'lib/zero/renderer.rb', line 40
-
-def type_map
-  @@map ||= {}
-end
-
-
-
- -
-

- - + (Object) type_map=(map) - - - - - -

-
- -

save a mapping hash for the type

- -

With that it is possible to map long and complex contant types to simpler -representations. These get then used in the finding process for the best -fitting template.

- - -
-
-
- -
-

Examples:

- - -
Zero::Renderer.map = {'text/html' => 'html'}
-
- -
-

Parameters:

-
    - -
  • - - map - - - (Hash) - - - - — -
    -

    maps the content type to a simple representation

    -
    - -
  • - -
- - -
- - - - -
-
-
-
-34
-35
-36
-
-
# File 'lib/zero/renderer.rb', line 34
-
-def type_map=(map)
-  @@map = map
-end
-
-
-
- -
- -
-

Instance Method Details

- - -
-

- - - (String) render - - - - - -

-
- -

render the template within the context

- - -
-
-
- -

Returns:

-
    - -
  • - - - (String) - - - - — -
    -

    the rendered template

    -
    - -
  • - -
- -
- - - - -
-
-
-
-57
-58
-59
-
-
# File 'lib/zero/renderer.rb', line 57
-
-def render
-  Tilt.new(@path).render(@context)
-end
-
-
-
- -
- -
- - - - - \ No newline at end of file -- cgit v1.2.3-70-g09d2