Class: Gemtext::Node
- Inherits:
-
Object
- Object
- Gemtext::Node
- Defined in:
- lib/gemtext/node.rb
Overview
‘Gemtext::Node` represents a piece of a document. There are a limited number of node types. They store their content with any formatting needed to identify that content removed.
Direct Known Subclasses
Heading, Link, ListItem, Preformatted, Quote, SubHeading, SubSubHeading, Text, Whitespace
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
The content of the node.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #deconstruct_keys(*_keys) ⇒ Object
-
#initialize(content = nil) ⇒ Node
constructor
A new instance of Node.
- #inspect ⇒ Object
Constructor Details
#initialize(content = nil) ⇒ Node
Returns a new instance of Node.
9 10 11 |
# File 'lib/gemtext/node.rb', line 9 def initialize(content = nil) @content = content end |
Instance Attribute Details
#content ⇒ Object (readonly)
The content of the node
7 8 9 |
# File 'lib/gemtext/node.rb', line 7 def content @content end |
Instance Method Details
#==(other) ⇒ Object
17 18 19 |
# File 'lib/gemtext/node.rb', line 17 def ==(other) other.class == self.class && other.content == @content end |
#deconstruct_keys(*_keys) ⇒ Object
21 22 23 |
# File 'lib/gemtext/node.rb', line 21 def deconstruct_keys(*_keys) { content: } end |
#inspect ⇒ Object
13 14 15 |
# File 'lib/gemtext/node.rb', line 13 def inspect "#{self.class}{#{content}}" end |