Sha256: 0d254c9b0ea0be2d88b6648de9c760612231c8266b065ff46e6d191d16c90e27

Contents?: true

Size: 672 Bytes

Versions: 5

Compression:

Stored size: 672 Bytes

Contents

class YARD::Handlers::Ruby::ExceptionHandler < YARD::Handlers::Ruby::Base
  handles method_call(:raise)
  
  def process
    return unless owner.is_a?(MethodObject) # Only methods yield
    return if owner.has_tag?(:raise)

    klass = nil
    params = statement.parameters(false)
    if params.size == 1 
      if params.first.ref? && params.first.first.type != :ident
        klass = params.first.source
      elsif params.first.call? && params.first.method_name(true) == :new
        klass = params.first.namespace.source
      end
    else
      klass = params.first.source
    end

    owner.docstring.add_tag YARD::Tags::Tag.new(:raise, '', klass) if klass
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yard-0.2.3.5 lib/yard/handlers/ruby/exception_handler.rb
yard-0.2.3.4 lib/yard/handlers/ruby/exception_handler.rb
yard-0.2.3.2 lib/yard/handlers/ruby/exception_handler.rb
yard-0.2.3.3 lib/yard/handlers/ruby/exception_handler.rb
yard-0.2.3 lib/yard/handlers/ruby/exception_handler.rb