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::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
12 13 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 |
# 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) attaching = false if @docstring =~ /^@!?macro\s+\[[^\]]*attach/ register_docstring(nil) @docstring = "" attaching = true end if macro = find_attached_macro txt = macro.([caller_method, *call_params], statement.source) @docstring += "\n" + txt if !attaching && txt.match(/^\s*@!/) # macro has a directive return register_docstring(nil) end 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
46 47 48 |
# File 'lib/yard/handlers/ruby/dsl_handler_methods.rb', line 46 def register_docstring(object, docstring = @docstring, stmt = statement) super end |