Class: Presently::Page
- Inherits:
-
Object
- Object
- Presently::Page
- 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.("page.xrb", __dir__))
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
- #The Live view to embed.= ⇒ Object writeonly
- #The page title.(pagetitle.) ⇒ Object readonly
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#call ⇒ Object
Render the page to an HTML string.
-
#initialize(title: "Presently", body: nil) ⇒ Page
constructor
Initialize a new page.
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
#body ⇒ Object (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 |
#title ⇒ Object (readonly)
Returns the value of attribute title.
27 28 29 |
# File 'lib/presently/page.rb', line 27 def title @title end |
Instance Method Details
#call ⇒ Object
Render the page to an HTML string.
34 35 36 |
# File 'lib/presently/page.rb', line 34 def call TEMPLATE.to_string(self) end |