Class: Jekyll::TreeNode
- Inherits:
-
Object
- Object
- Jekyll::TreeNode
- Defined in:
- lib/jekyll-semtree/tree.rb
Overview
def to_s
"<Node text: '#{@text}', ancestors: #{@ancestors}, children: #{@children}"
end
end
Instance Attribute Summary collapse
-
#ancestors ⇒ Object
array of strings for the text of each node from root to current (leaf).
-
#children ⇒ Object
array of strings for the text of each child node.
-
#doc ⇒ Object
the associated jekyll document.
-
#id ⇒ Object
doc properties.
-
#level ⇒ Object
level in the tree.
-
#line ⇒ Object
Returns the value of attribute line.
-
#text ⇒ Object
line of the index file content does not include stripped content (e.g. yaml); value for index docs is -1.
-
#url ⇒ Object
jekyll blog url for the given node/page.
Instance Method Summary collapse
-
#initialize(text, ancestors = [], level = -1,, line = -1,, children = [], doc = "") ⇒ TreeNode
constructor
A new instance of TreeNode.
- #missing ⇒ Object
-
#namespace ⇒ Object
for legacy ‘jekyll-namespaces’ calls.
- #title ⇒ Object
- #to_s ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(text, ancestors = [], level = -1,, line = -1,, children = [], doc = "") ⇒ TreeNode
Returns a new instance of TreeNode.
435 436 437 438 439 440 441 442 443 444 |
# File 'lib/jekyll-semtree/tree.rb', line 435 def initialize(text, ancestors=[], level=-1, line=-1, children=[], doc="") # mandatory @text = text @ancestors = ancestors # optional @children = children @level = level @line = line @doc = doc end |
Instance Attribute Details
#ancestors ⇒ Object
array of strings for the text of each node from root to current (leaf)
425 426 427 |
# File 'lib/jekyll-semtree/tree.rb', line 425 def ancestors @ancestors end |
#children ⇒ Object
array of strings for the text of each child node
426 427 428 |
# File 'lib/jekyll-semtree/tree.rb', line 426 def children @children end |
#doc ⇒ Object
the associated jekyll document
427 428 429 |
# File 'lib/jekyll-semtree/tree.rb', line 427 def doc @doc end |
#id ⇒ Object
doc properties
424 425 426 |
# File 'lib/jekyll-semtree/tree.rb', line 424 def id @id end |
#level ⇒ Object
level in the tree
428 429 430 |
# File 'lib/jekyll-semtree/tree.rb', line 428 def level @level end |
#line ⇒ Object
Returns the value of attribute line.
429 430 431 |
# File 'lib/jekyll-semtree/tree.rb', line 429 def line @line end |
#text ⇒ Object
line of the index file content does not include stripped content (e.g. yaml); value for index docs is -1
432 433 434 |
# File 'lib/jekyll-semtree/tree.rb', line 432 def text @text end |
#url ⇒ Object
jekyll blog url for the given node/page
433 434 435 |
# File 'lib/jekyll-semtree/tree.rb', line 433 def url @url end |
Instance Method Details
#missing ⇒ Object
446 447 448 449 |
# File 'lib/jekyll-semtree/tree.rb', line 446 def missing return @doc == '' # return (@doc.nil? || (@doc.class == String)) end |
#namespace ⇒ Object
for legacy ‘jekyll-namespaces’ calls
474 475 476 |
# File 'lib/jekyll-semtree/tree.rb', line 474 def namespace return false end |
#title ⇒ Object
465 466 467 |
# File 'lib/jekyll-semtree/tree.rb', line 465 def title return (self.missing) ? @text : @doc.data['title'] end |
#to_s ⇒ Object
451 452 453 |
# File 'lib/jekyll-semtree/tree.rb', line 451 def to_s "<Node text: '#{@text}', ancestors: #{@ancestors}, children: #{@children}" end |
#type ⇒ Object
469 470 471 |
# File 'lib/jekyll-semtree/tree.rb', line 469 def type return (self.missing) ? 'zombie' : @doc.type end |