Sha256: 98d56ac7342ff6c6d805abb1dc26ce9484eae60f56416cd48e1063adf46fc841

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 KB

Contents

module YARD
  module Handlers
    module Ruby
      module Legacy
        # (see Ruby::MacroHandler)
        class MacroHandler < Base
          include CodeObjects
          include MacroHandlerMethods
          handles TkIDENTIFIER
          namespace_only

          process do
            return if namespace == Registry.root
            globals.__attached_macros ||= {}
            if !globals.__attached_macros[caller_method]
              return if Ruby::MacroHandler::IGNORE_METHODS[caller_method]
              return if !statement.comments || statement.comments.empty?
            end

            comments = statement.comments ? statement.comments.join("\n") : ""
            @macro, @docstring = nil, Docstring.new(comments)
            find_or_create_macro(@docstring)
            return if !@macro && !statement.comments_hash_flag && @docstring.tags.size == 0
            @docstring = expanded_macro_or_docstring
            name = method_name
            raise UndocumentableError, "method, missing name" if name.nil? || name.empty?
            tmp_scope = sanitize_scope
            tmp_vis = sanitize_visibility
            object = MethodObject.new(namespace, name, tmp_scope)
            register(object)
            object.visibility = tmp_vis
            object.dynamic = true
            object.signature = method_signature
            create_attribute_data(object)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yard-0.7.1 lib/yard/handlers/ruby/legacy/macro_handler.rb
yard-0.7.0 lib/yard/handlers/ruby/legacy/macro_handler.rb