Class: YARD::Handlers::Ruby::YieldHandler
- Defined in:
- lib/yard/handlers/ruby/yield_handler.rb
Overview
Handles ‘yield’ calls
Constant Summary
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
-
#process ⇒ void
Main processing callback.
Methods included from Parser::Ruby
Methods included from CodeObjects::NamespaceMapper
#clear_separators, #default_separator, on_invalidate, #register_separator, #separators, #separators_for_type, #separators_match, #types_for_separator, #unregister_separator_by_type
Constructor Details
This class inherits a constructor from YARD::Handlers::Base
Instance Method Details
#process ⇒ void
This method returns an undefined value.
Main processing callback
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/yard/handlers/ruby/yield_handler.rb', line 6 process do return unless owner.is_a?(MethodObject) # Only methods yield return if owner.has_tag? :yield # Don't override yield tags return if owner.has_tag? :yieldparam # Same thing. yieldtag = YARD::Tags::Tag.new(:yield, "", []) if statement.type == :yield statement.jump(:list).children.each do |item| if item == s(:var_ref, s(:kw, "self")) yieldtag.types << '_self' owner.add_tag YARD::Tags::Tag.new(:yieldparam, "the object that the method was called on", owner.namespace.path, '_self') elsif item == s(:zsuper) yieldtag.types << '_super' owner.add_tag YARD::Tags::Tag.new(:yieldparam, "the result of the method from the superclass", nil, '_super') else yieldtag.types << item.source end end end owner.add_tag(yieldtag) unless yieldtag.types.empty? end |