Class: Gumdrop::Renderer
- Inherits:
-
Object
- Object
- Gumdrop::Renderer
- Includes:
- Util::SiteAccess
- Defined in:
- lib/gumdrop/renderer.rb
Constant Summary collapse
- SPECIAL_OPTS =
%w(layout force_partial)
Instance Attribute Summary collapse
-
#cache ⇒ Object
readonly
Returns the value of attribute cache.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#ctx_pool ⇒ Object
readonly
Returns the value of attribute ctx_pool.
Class Method Summary collapse
-
.for(ext) ⇒ Object
Returns the ‘Tilt::Template` for the given `ext` or nil.
Instance Method Summary collapse
- #draw(content, opts = {}) ⇒ Object
-
#initialize ⇒ Renderer
constructor
A new instance of Renderer.
Methods included from Util::SiteAccess
Methods included from Util::Loggable
Methods included from Util::Eventable
#clear_events, #event_block, #fire
Constructor Details
#initialize ⇒ Renderer
Returns a new instance of Renderer.
10 11 12 13 14 15 |
# File 'lib/gumdrop/renderer.rb', line 10 def initialize site.active_renderer= self @context, @content, @opts= nil, nil, nil @ctx_pool= ContextPool.new self @cache= {} end |
Instance Attribute Details
#cache ⇒ Object (readonly)
Returns the value of attribute cache.
8 9 10 |
# File 'lib/gumdrop/renderer.rb', line 8 def cache @cache end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
8 9 10 |
# File 'lib/gumdrop/renderer.rb', line 8 def context @context end |
#ctx_pool ⇒ Object (readonly)
Returns the value of attribute ctx_pool.
8 9 10 |
# File 'lib/gumdrop/renderer.rb', line 8 def ctx_pool @ctx_pool end |
Class Method Details
.for(ext) ⇒ Object
Returns the ‘Tilt::Template` for the given `ext` or nil
200 201 202 203 204 |
# File 'lib/gumdrop/renderer.rb', line 200 def for(ext) Tilt[ext] rescue LoadError # stupid tilt and redcarpet, they don't play well together! nil end |
Instance Method Details
#draw(content, opts = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/gumdrop/renderer.rb', line 17 def draw(content, opts={}) if @ctx_pool.size > 0 _start_rendering(content, opts) else event_block :render_item do |data| _start_rendering(content, opts, data) end end end |