Class: Presently::Page

Inherits:
Object
  • Object
show all
Defined in:
lib/presently/page.rb

Overview

The HTML page shell for a Presently view.

Renders the initial HTML page with the import map, stylesheets, and the embedded Live view component. Uses a custom XRB template that includes Presently’s assets (syntax highlighting, etc.).

Constant Summary collapse

TEMPLATE =

The compiled XRB template for the page shell.

XRB::Template.load_file(File.expand_path("page.xrb", __dir__))

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title: "Presently", body: nil) ⇒ Page

Initialize a new page.



21
22
23
24
# File 'lib/presently/page.rb', line 21

def initialize(title: "Presently", body: nil)
	@title = title
	@body = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



30
31
32
# File 'lib/presently/page.rb', line 30

def body
  @body
end

#The Live view to embed.=(value) ⇒ Object (writeonly)



30
# File 'lib/presently/page.rb', line 30

attr :body

#The page title.(pagetitle.) ⇒ Object (readonly)



27
# File 'lib/presently/page.rb', line 27

attr :title

#titleObject (readonly)

Returns the value of attribute title.



27
28
29
# File 'lib/presently/page.rb', line 27

def title
  @title
end

Instance Method Details

#callObject

Render the page to an HTML string.



34
35
36
# File 'lib/presently/page.rb', line 34

def call
	TEMPLATE.to_string(self)
end