make class functions more clear in renderer
This commit is contained in:
parent
2e073a07fa
commit
d7c217bd30
@ -14,30 +14,32 @@ 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
|
||||||
# set a base path for template search
|
class << self
|
||||||
# @param path [String] the path to the template base dir
|
# set a base path for template search
|
||||||
def self.template_path=(path)
|
# @param path [String] the path to the template base dir
|
||||||
@@path = path + '/'
|
def template_path=(path)
|
||||||
end
|
@@path = path + '/'
|
||||||
|
end
|
||||||
|
|
||||||
# save a mapping hash for the type
|
# save a mapping hash for the type
|
||||||
#
|
#
|
||||||
# With that it is possible to map long and complex contant types to simpler
|
# 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
|
# representations. These get then used in the finding process for the best
|
||||||
# fitting template.
|
# fitting template.
|
||||||
#
|
#
|
||||||
# @example
|
# @example
|
||||||
# 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
|
||||||
|
Loading…
Reference in New Issue
Block a user