Class: Rock::Doc::HTML::RenderingContext
- Inherits:
-
Object
- Object
- Rock::Doc::HTML::RenderingContext
- Defined in:
- lib/rock/doc.rb
Overview
Base class for rendering contexts
Direct Known Subclasses
PackageRenderingContext, TaskRenderingContext, TypeRenderingContext, VCSRenderingContext
Instance Attribute Summary collapse
-
#default_template ⇒ Object
readonly
Returns the value of attribute default_template.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
-
#help_tip(text) ⇒ Object
No help tips by default, it relies on having specialized mechanisms too much.
-
#initialize(object, *default_template) ⇒ RenderingContext
constructor
Mapped object.
-
#link_to(arg) ⇒ Object
No links by default.
- #render(*template_path) ⇒ Object
-
#render_item(name, value = nil) ⇒ Object
Create an item for the rendering in tables.
- #render_object(object, *template_path) ⇒ Object
Constructor Details
#initialize(object, *default_template) ⇒ RenderingContext
Mapped object
130 131 132 133 |
# File 'lib/rock/doc.rb', line 130 def initialize(object, *default_template) @object = object @default_template = default_template end |
Instance Attribute Details
#default_template ⇒ Object (readonly)
Returns the value of attribute default_template
127 128 129 |
# File 'lib/rock/doc.rb', line 127 def default_template @default_template end |
#object ⇒ Object (readonly)
Returns the value of attribute object
126 127 128 |
# File 'lib/rock/doc.rb', line 126 def object @object end |
Instance Method Details
#help_tip(text) ⇒ Object
No help tips by default, it relies on having specialized mechanisms too much
148 |
# File 'lib/rock/doc.rb', line 148 def help_tip(text); "" end |
#link_to(arg) ⇒ Object
No links by default
136 137 138 139 140 141 142 143 144 |
# File 'lib/rock/doc.rb', line 136 def link_to(arg) text = if arg.respond_to?(:name) arg.name else arg.to_s end Doc::HTML.escape_html(text) end |
#render(*template_path) ⇒ Object
159 160 161 162 |
# File 'lib/rock/doc.rb', line 159 def render(*template_path) template_path += [binding] HTML.render_template(*template_path) end |
#render_item(name, value = nil) ⇒ Object
Create an item for the rendering in tables
151 152 153 154 155 156 157 |
# File 'lib/rock/doc.rb', line 151 def render_item(name, value = nil) if value "<li><b>#{name}</b>: #{value}</li>" else "<li><b>#{name}</b></li>" end end |
#render_object(object, *template_path) ⇒ Object
164 165 166 |
# File 'lib/rock/doc.rb', line 164 def render_object(object, *template_path) HTML.render_object(object, *template_path) end |