Sha256: 6829ee6d8a578e695b7ea0bdf17e2af7c2ca876cd8eb0c1d9508513dffd33bd1

Contents?: true

Size: 1.43 KB

Versions: 28

Compression:

Stored size: 1.43 KB

Contents

module YARD
  module Handlers
    module Ruby
      # Handles a macro (dsl-style method)
      class MacroHandler < Base
        include CodeObjects
        include MacroHandlerMethods
        handles method_call
        namespace_only
        
        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] }.flatten]
        
        process do
          globals.__attached_macros ||= {}
          if !globals.__attached_macros[caller_method]
            return if IGNORE_METHODS[caller_method]
            return if !statement.comments || statement.comments.empty?
          end
          
          @macro, @docstring = nil, Docstring.new(statement.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

Version data entries

28 entries across 28 versions & 4 rubygems

Version Path
challah-0.6.2 vendor/bundle/gems/yard-0.7.5/lib/yard/handlers/ruby/macro_handler.rb
challah-0.6.1 vendor/bundle/gems/yard-0.7.5/lib/yard/handlers/ruby/macro_handler.rb
challah-0.6.0 vendor/bundle/gems/yard-0.7.5/lib/yard/handlers/ruby/macro_handler.rb
challah-0.5.4 vendor/bundle/gems/yard-0.7.5/lib/yard/handlers/ruby/macro_handler.rb
challah-0.5.3 vendor/bundle/gems/yard-0.7.5/lib/yard/handlers/ruby/macro_handler.rb
challah-0.5.2 vendor/bundle/gems/yard-0.7.5/lib/yard/handlers/ruby/macro_handler.rb
challah-0.5.1 vendor/bundle/gems/yard-0.7.5/lib/yard/handlers/ruby/macro_handler.rb
challah-0.5.0 vendor/bundle/gems/yard-0.7.5/lib/yard/handlers/ruby/macro_handler.rb
challah-0.4.1 vendor/bundle/gems/yard-0.7.5/lib/yard/handlers/ruby/macro_handler.rb
challah-0.4.0 vendor/bundle/gems/yard-0.7.5/lib/yard/handlers/ruby/macro_handler.rb
challah-0.3.5 vendor/bundle/gems/yard-0.7.5/lib/yard/handlers/ruby/macro_handler.rb
challah-0.3.4 vendor/bundle/gems/yard-0.7.5/lib/yard/handlers/ruby/macro_handler.rb
challah-0.3.3 vendor/bundle/gems/yard-0.7.5/lib/yard/handlers/ruby/macro_handler.rb
challah-0.3.2 vendor/bundle/gems/yard-0.7.5/lib/yard/handlers/ruby/macro_handler.rb
challah-0.3.1 vendor/bundle/gems/yard-0.7.5/lib/yard/handlers/ruby/macro_handler.rb
challah-0.3.0 vendor/bundle/gems/yard-0.7.5/lib/yard/handlers/ruby/macro_handler.rb
challah-0.2.1 vendor/bundle/gems/yard-0.7.5/lib/yard/handlers/ruby/macro_handler.rb
challah-0.2.0 vendor/bundle/gems/yard-0.7.5/lib/yard/handlers/ruby/macro_handler.rb
yard-0.7.5 lib/yard/handlers/ruby/macro_handler.rb
nutshell-crm-0.0.6.alpha vendor/bundle/gems/yard-0.7.4/lib/yard/handlers/ruby/macro_handler.rb