Class: Lively::Pages::Index
- Inherits:
-
Object
- Object
- Lively::Pages::Index
- Defined in:
- lib/lively/pages/index.rb
Overview
Represents the main index page for a Lively application.
This class renders the initial HTML page that users see when they visit a Lively application. It uses an XRB template to generate the page structure and embeds the Live view component for dynamic content.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
- #The title of the page.(titleofthepage.) ⇒ Object readonly
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#call ⇒ Object
Render this page to a string.
-
#initialize(title: "Lively", body: nil) ⇒ Index
constructor
Initialize a new index page.
- #The body content of the page.=(bodycontentofthepage. = (value)) ⇒ Object
- #The XRB template for rendering the page.=(XRBtemplate) ⇒ Object
Constructor Details
#initialize(title: "Lively", body: nil) ⇒ Index
Initialize a new index page.
21 22 23 24 25 26 27 |
# File 'lib/lively/pages/index.rb', line 21 def initialize(title: "Lively", body: nil) @title = title @body = body path = File.("index.xrb", __dir__) @template = XRB::Template.load_file(path) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
33 34 35 |
# File 'lib/lively/pages/index.rb', line 33 def body @body end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
36 37 38 |
# File 'lib/lively/pages/index.rb', line 36 def template @template end |
#The title of the page.(titleofthepage.) ⇒ Object (readonly)
30 |
# File 'lib/lively/pages/index.rb', line 30 attr :title |
#title ⇒ Object (readonly)
Returns the value of attribute title.
30 31 32 |
# File 'lib/lively/pages/index.rb', line 30 def title @title end |
Instance Method Details
#call ⇒ Object
Render this page to a string.
40 41 42 |
# File 'lib/lively/pages/index.rb', line 40 def call @template.to_string(self) end |
#The body content of the page.=(bodycontentofthepage. = (value)) ⇒ Object
33 |
# File 'lib/lively/pages/index.rb', line 33 attr :body |
#The XRB template for rendering the page.=(XRBtemplate) ⇒ Object
36 |
# File 'lib/lively/pages/index.rb', line 36 attr :template |