Module: YardThunder::MethodHandlerDescriptionMixin

Included in:
YARD::Handlers::Ruby::MethodHandler
Defined in:
lib/yard-thunder/description.rb

Overview

process do

  parser.extra_state ||= {}
  parser.extra_state[:thunder_desc] = tokval_list(statement.tokens[1..-1], :attr)
end

end

Instance Method Summary collapse

Instance Method Details

#processObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/yard-thunder/description.rb', line 23

def process
  super
  return unless parser.extra_state
  #TODO: create a second code object for the thunder command itself

  # handle a command description for this method
  if parser.extra_state.thunder_desc
    usage, desc = *parser.extra_state.thunder_desc
    # drop in the description, if there is no "real" docstring
    tags = @registered_object.tags
    @registered_object.docstring = desc
    tags.each { |tag| @registered_object.docstring.add_tag(tag) }
    @registered_object.signature = usage

    # add a second code object to describe the command line interface for this command
    @registered_object.namespace.groups << ["Thunder Commands"] unless @registered_object.namespace.groups.include? "Thunder Commands"
    # @registered_object.group = "Thunder Commands"
    # @registered_object.docstring.add_tag YARD::Tags::Tag.new(:thunder_command, '')
    parser.extra_state.thunder_desc = nil
  end
end