Class: Raml::Node
- Inherits:
-
Object
- Object
- Raml::Node
- Defined in:
- lib/raml/node.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Raml::Node
The node’s parent.
Class Method Summary collapse
Instance Method Summary collapse
-
#document ⇒ String
Returns HTML documenting the node and child nodes.
-
#initialize(name, parent) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(name, parent) ⇒ Node
Returns a new instance of Node.
34 35 36 37 |
# File 'lib/raml/node.rb', line 34 def initialize(name, parent) @name = name @parent = parent end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
29 30 31 |
# File 'lib/raml/node.rb', line 29 def name @name end |
#parent ⇒ Raml::Node
Returns the node’s parent.
32 33 34 |
# File 'lib/raml/node.rb', line 32 def parent @parent end |
Class Method Details
.relative_path(file) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/raml/node.rb', line 12 def relative_path(file) File.join( *File.dirname(__FILE__). split(File::SEPARATOR). reverse. drop_while { |p| p != 'lib' }. drop(1). reverse, 'templates', file ) end |
Instance Method Details
#document ⇒ String
Returns HTML documenting the node and child nodes.
41 42 43 44 45 46 47 48 |
# File 'lib/raml/node.rb', line 41 def document if doc_template self.doc_template_compiled ||= Slim::Template.new(doc_template, format: :html5, pretty: true) doc_template_compiled.render self else nil end end |