Class: Presently::TemplateScope
- Inherits:
-
Object
- Object
- Presently::TemplateScope
- Defined in:
- lib/presently/slide_renderer.rb
Overview
Provides the scope for XRB template rendering.
Templates access slide content via ‘self.section(name)` and slide metadata via `self.slide`.
Instance Attribute Summary collapse
-
#slide ⇒ Object
readonly
Returns the value of attribute slide.
Instance Method Summary collapse
-
#content ⇒ Object
The content sections of the slide.
-
#initialize(slide) ⇒ TemplateScope
constructor
Initialize a new template scope for the given slide.
-
#section(name) ⇒ Object
Get a named content section as raw HTML markup.
-
#section?(name) ⇒ Boolean
Whether the named content section exists and has content.
- #The slide being rendered.=(slidebeingrendered. = (value)) ⇒ Object
Constructor Details
#initialize(slide) ⇒ TemplateScope
Initialize a new template scope for the given slide.
49 50 51 |
# File 'lib/presently/slide_renderer.rb', line 49 def initialize() @slide = end |
Instance Attribute Details
#slide ⇒ Object (readonly)
Returns the value of attribute slide.
54 55 56 |
# File 'lib/presently/slide_renderer.rb', line 54 def @slide end |
Instance Method Details
#content ⇒ Object
The content sections of the slide.
58 59 60 |
# File 'lib/presently/slide_renderer.rb', line 58 def content @slide.content end |
#section(name) ⇒ Object
Get a named content section as raw HTML markup.
72 73 74 |
# File 'lib/presently/slide_renderer.rb', line 72 def section(name) XRB::MarkupString.raw(@slide.content[name] || "") end |
#section?(name) ⇒ Boolean
Whether the named content section exists and has content.
65 66 67 |
# File 'lib/presently/slide_renderer.rb', line 65 def section?(name) !(@slide.content[name] || "").empty? end |
#The slide being rendered.=(slidebeingrendered. = (value)) ⇒ Object
54 |
# File 'lib/presently/slide_renderer.rb', line 54 attr :slide |