0
0

make class functions more clear in renderer

This commit is contained in:
Gibheer 2012-11-17 09:25:05 +01:00
parent 2e073a07fa
commit d7c217bd30

View File

@ -14,9 +14,10 @@ module Zero
# The call to #render will return the String representation of the template # The call to #render will return the String representation of the template
# with all data given. # with all data given.
class Renderer class Renderer
class << self
# set a base path for template search # set a base path for template search
# @param path [String] the path to the template base dir # @param path [String] the path to the template base dir
def self.template_path=(path) def template_path=(path)
@@path = path + '/' @@path = path + '/'
end end
@ -30,15 +31,16 @@ module Zero
# Zero::Renderer.map = {'text/html' => 'html'} # Zero::Renderer.map = {'text/html' => 'html'}
# #
# @param map [Hash] maps the content type to a simple representation # @param map [Hash] maps the content type to a simple representation
def self.type_map=(map) def type_map=(map)
@@map = map @@map = map
end end
# returns the type map # returns the type map
# @return [Hash] the mapping for types # @return [Hash] the mapping for types
def self.type_map def type_map
@@map ||= {} @@map ||= {}
end end
end
# take the path and render the template within the context # take the path and render the template within the context
# @param path [String] the relative path to the template # @param path [String] the relative path to the template