Module: YARD::Handlers::Ruby::DSLHandlerMethods

Includes:
CodeObjects, Parser
Included in:
DSLHandler, Legacy::DSLHandler
Defined in:
lib/yard/handlers/ruby/dsl_handler_methods.rb

Constant Summary collapse

IGNORE_METHODS =
Hash[*%w(alias alias_method autoload attr attr_accessor
attr_reader attr_writer extend include public private protected
private_constant).map {|n| [n, true]

Constants included from CodeObjects

CodeObjects::BUILTIN_ALL, CodeObjects::BUILTIN_CLASSES, CodeObjects::BUILTIN_EXCEPTIONS, CodeObjects::BUILTIN_EXCEPTIONS_HASH, CodeObjects::BUILTIN_MODULES, CodeObjects::CONSTANTMATCH, CodeObjects::CSEP, CodeObjects::CSEPQ, CodeObjects::ISEP, CodeObjects::ISEPQ, CodeObjects::METHODMATCH, CodeObjects::METHODNAMEMATCH, CodeObjects::NAMESPACEMATCH, CodeObjects::NSEP, CodeObjects::NSEPQ

Instance Method Summary collapse

Instance Method Details

#handle_commentsObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/yard/handlers/ruby/dsl_handler_methods.rb', line 12

def handle_comments
  return if IGNORE_METHODS[caller_method]

  @docstring = statement.comments || ""
  @docstring = @docstring.join("\n") if @docstring.is_a?(Array)
  if macro = find_attached_macro
    @docstring += "\n" +
      macro.expand([caller_method, *call_params], statement.source)
  elsif !statement.comments_hash_flag && !implicit_docstring?
    return register_docstring(nil)
  end

  # ignore DSL definitions if @method/@attribute directive is used
  if @docstring =~ /^@!?(method|attribute)\b/
    return register_docstring(nil)
  end

  object = MethodObject.new(namespace, method_name, scope)
  object.signature = method_signature
  register(object)
end

#register_docstring(object, docstring = @docstring, stmt = statement) ⇒ Object



34
35
36
# File 'lib/yard/handlers/ruby/dsl_handler_methods.rb', line 34

def register_docstring(object, docstring = @docstring, stmt = statement)
  super
end