Class: Presently::TemplateScope

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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)
	@slide = slide
end

Instance Attribute Details

#slideObject (readonly)

Returns the value of attribute slide.



54
55
56
# File 'lib/presently/slide_renderer.rb', line 54

def slide
  @slide
end

Instance Method Details

#contentObject

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.

Returns:

  • (Boolean)


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