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 module_function public private protected private_constant private_class_method public_class_method). 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::CONSTANTSTART, CodeObjects::CSEP, CodeObjects::CSEPQ, CodeObjects::ISEP, CodeObjects::ISEPQ, CodeObjects::METHODMATCH, CodeObjects::METHODNAMEMATCH, CodeObjects::NAMESPACEMATCH, CodeObjects::NSEP, CodeObjects::NSEPQ
Instance Method Summary collapse
- #handle_comments ⇒ Object
- #register_docstring(object, docstring = @docstring, stmt = statement) ⇒ Object
Methods included from CodeObjects::NamespaceMapper
#clear_separators, #default_separator, #register_separator, #separators, #separators_for_type, #separators_match, #types_for_separator
Instance Method Details
#handle_comments ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/yard/handlers/ruby/dsl_handler_methods.rb', line 14 def handle_comments return if IGNORE_METHODS[caller_method] @docstring = statement.comments || "" @docstring = @docstring.join("\n") if @docstring.is_a?(Array) attaching = false if @docstring =~ /^@!?macro\s+\[[^\]]*attach/ register_docstring(nil) @docstring = "" attaching = true end macro = find_attached_macro if macro txt = macro.([caller_method, *call_params], statement.source) @docstring += "\n" + txt # macro may have a directive return register_docstring(nil) if !attaching && txt.match(/^\s*@!/) 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
48 49 50 |
# File 'lib/yard/handlers/ruby/dsl_handler_methods.rb', line 48 def register_docstring(object, docstring = @docstring, stmt = statement) super end |