Class: Yoda::Model::Descriptions::CommentTokenDescription

Inherits:
Base
  • Object
show all
Defined in:
lib/yoda/model/descriptions/comment_token_description.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#label

Constructor Details

#initialize(comment_token, type) ⇒ CommentTokenDescription

Returns a new instance of CommentTokenDescription.

Parameters:



13
14
15
16
# File 'lib/yoda/model/descriptions/comment_token_description.rb', line 13

def initialize(comment_token, type)
  @comment_token = comment_token
  @type = type
end

Instance Attribute Details

#comment_tokenAST::CommentBlock::Token (readonly)



6
7
8
# File 'lib/yoda/model/descriptions/comment_token_description.rb', line 6

def comment_token
  @comment_token
end

#typeTypeExpressions::Base (readonly)



9
10
11
# File 'lib/yoda/model/descriptions/comment_token_description.rb', line 9

def type
  @type
end

Instance Method Details

#markup_contentObject



37
38
39
40
41
42
# File 'lib/yoda/model/descriptions/comment_token_description.rb', line 37

def markup_content
  {
    language: 'ruby',
    value: "#{title.gsub("\n", ";")} # #{type}",
  }
end

#sort_textString

Returns:

  • (String)


24
25
26
# File 'lib/yoda/model/descriptions/comment_token_description.rb', line 24

def sort_text
  comment_token.content
end

#titleString

Returns:

  • (String)


19
20
21
# File 'lib/yoda/model/descriptions/comment_token_description.rb', line 19

def title
  comment_token.content
end

#to_markdownString

Returns:

  • (String)


29
30
31
32
33
34
35
# File 'lib/yoda/model/descriptions/comment_token_description.rb', line 29

def to_markdown
  <<~EOS
  **#{title}**

  #{value.document}
  EOS
end