Class: Yoda::Model::Descriptions::NodeDescription
- Defined in:
- lib/yoda/model/descriptions/node_description.rb
Instance Attribute Summary collapse
- #node ⇒ ::Parser::AST::Node readonly
- #type ⇒ TypeExpressions::Base readonly
Instance Method Summary collapse
-
#initialize(node, type) ⇒ NodeDescription
constructor
A new instance of NodeDescription.
- #markup_content ⇒ Object
- #sort_text ⇒ String
- #title ⇒ String
- #to_markdown ⇒ String
Methods inherited from Base
Constructor Details
#initialize(node, type) ⇒ NodeDescription
Returns a new instance of NodeDescription.
15 16 17 18 |
# File 'lib/yoda/model/descriptions/node_description.rb', line 15 def initialize(node, type) @node = node @type = type end |
Instance Attribute Details
#node ⇒ ::Parser::AST::Node (readonly)
8 9 10 |
# File 'lib/yoda/model/descriptions/node_description.rb', line 8 def node @node end |
#type ⇒ TypeExpressions::Base (readonly)
11 12 13 |
# File 'lib/yoda/model/descriptions/node_description.rb', line 11 def type @type end |
Instance Method Details
#markup_content ⇒ Object
37 38 39 40 41 42 |
# File 'lib/yoda/model/descriptions/node_description.rb', line 37 def markup_content { language: 'ruby', value: "#{node_body.gsub("\n", ";")} # #{type}", } end |
#sort_text ⇒ String
26 27 28 |
# File 'lib/yoda/model/descriptions/node_description.rb', line 26 def sort_text node_body end |
#title ⇒ String
21 22 23 |
# File 'lib/yoda/model/descriptions/node_description.rb', line 21 def title node_body end |
#to_markdown ⇒ String
31 32 33 34 35 |
# File 'lib/yoda/model/descriptions/node_description.rb', line 31 def to_markdown <<~EOS #{node_body.gsub("\n", ";")}: #{type} EOS end |