Class: Jekyll::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll-namespaces/tree.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(namespace, id = "", title = "", url = "", doc = "") ⇒ Node

Returns a new instance of Node.



149
150
151
152
153
154
155
156
157
158
159
# File 'lib/jekyll-namespaces/tree.rb', line 149

def initialize(namespace, id="", title="", url="", doc="")
  # mandatory
  @namespace = namespace
  # optional
  @id = id.to_s
  @title = title
  @url = url.nil? ? "" : url
  @doc = doc
  # auto-init
  @children = []
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



147
148
149
# File 'lib/jekyll-namespaces/tree.rb', line 147

def children
  @children
end

#docObject

Returns the value of attribute doc.



147
148
149
# File 'lib/jekyll-namespaces/tree.rb', line 147

def doc
  @doc
end

#idObject

Returns the value of attribute id.



147
148
149
# File 'lib/jekyll-namespaces/tree.rb', line 147

def id
  @id
end

#namespaceObject

Returns the value of attribute namespace.



147
148
149
# File 'lib/jekyll-namespaces/tree.rb', line 147

def namespace
  @namespace
end

#titleObject

Returns the value of attribute title.



147
148
149
# File 'lib/jekyll-namespaces/tree.rb', line 147

def title
  @title
end

#urlObject

Returns the value of attribute url.



147
148
149
# File 'lib/jekyll-namespaces/tree.rb', line 147

def url
  @url
end

Instance Method Details

#fill(id, title, url, doc) ⇒ Object



161
162
163
164
165
166
# File 'lib/jekyll-namespaces/tree.rb', line 161

def fill(id, title, url, doc)
  @id = id
  @title = title
  @url = url
  @doc = doc
end

#missingObject



168
169
170
# File 'lib/jekyll-namespaces/tree.rb', line 168

def missing
  return @doc == ""
end

#to_sObject



176
177
178
# File 'lib/jekyll-namespaces/tree.rb', line 176

def to_s
  "namespace: #{@namespace}"
end

#typeObject



172
173
174
# File 'lib/jekyll-namespaces/tree.rb', line 172

def type
  return @doc.type
end