Class: Yoda::Model::Descriptions::FunctionDescription

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#markup_content

Constructor Details

#initialize(function) ⇒ FunctionDescription

Returns a new instance of FunctionDescription.

Parameters:



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

def initialize(function)
  fail ArgumentError, function unless function.is_a?(FunctionSignatures::Wrapper)
  @function = function
end

Instance Attribute Details

#functionFunctionSignatures::Base (readonly)



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

def function
  @function
end

Instance Method Details

#labelObject



18
19
20
# File 'lib/yoda/model/descriptions/function_description.rb', line 18

def label
  signature
end

#parameter_namesObject



30
31
32
# File 'lib/yoda/model/descriptions/function_description.rb', line 30

def parameter_names
  function.parameters.parameter_names
end

#signatureObject



22
23
24
# File 'lib/yoda/model/descriptions/function_description.rb', line 22

def signature
  "#{function.to_s}"
end

#sort_textObject



26
27
28
# File 'lib/yoda/model/descriptions/function_description.rb', line 26

def sort_text
  function.name.to_s
end

#titleObject



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

def title
  "#{function.namespace_path}#{function.sep}#{function.to_s}"
end

#to_markdownObject



34
35
36
37
38
39
40
41
# File 'lib/yoda/model/descriptions/function_description.rb', line 34

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

  #{function.document}
  #{tag_documents}
  EOS
end