Class: Asciibook::Page
- Inherits:
-
Object
- Object
- Asciibook::Page
- Defined in:
- lib/asciibook/page.rb
Instance Attribute Summary collapse
-
#footnotes ⇒ Object
Returns the value of attribute footnotes.
-
#next_page ⇒ Object
Returns the value of attribute next_page.
-
#node ⇒ Object
Returns the value of attribute node.
-
#path ⇒ Object
Returns the value of attribute path.
-
#prev_page ⇒ Object
Returns the value of attribute prev_page.
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(path:, node:) ⇒ Page
constructor
A new instance of Page.
- #title ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(path:, node:) ⇒ Page
Returns a new instance of Page.
5 6 7 8 9 10 |
# File 'lib/asciibook/page.rb', line 5 def initialize(path:, node:) @path = path @node = node @footnotes = [] end |
Instance Attribute Details
#footnotes ⇒ Object
Returns the value of attribute footnotes.
3 4 5 |
# File 'lib/asciibook/page.rb', line 3 def footnotes @footnotes end |
#next_page ⇒ Object
Returns the value of attribute next_page.
3 4 5 |
# File 'lib/asciibook/page.rb', line 3 def next_page @next_page end |
#node ⇒ Object
Returns the value of attribute node.
3 4 5 |
# File 'lib/asciibook/page.rb', line 3 def node @node end |
#path ⇒ Object
Returns the value of attribute path.
3 4 5 |
# File 'lib/asciibook/page.rb', line 3 def path @path end |
#prev_page ⇒ Object
Returns the value of attribute prev_page.
3 4 5 |
# File 'lib/asciibook/page.rb', line 3 def prev_page @prev_page end |
Instance Method Details
#content ⇒ Object
16 17 18 |
# File 'lib/asciibook/page.rb', line 16 def content node.convert end |
#title ⇒ Object
12 13 14 |
# File 'lib/asciibook/page.rb', line 12 def title node.title end |
#to_hash ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/asciibook/page.rb', line 20 def to_hash { 'path' => path, 'title' => title, 'content' => content, 'prev_page' => prev_page && { 'path' => prev_page.path, 'title' => prev_page.title }, 'next_page' => next_page && { 'path' => next_page.path, 'title' => next_page.title } } end |