Sha256: 0759ff70a417521d9b754dbee0681d698cfcbd10756c0065872a0edbf4eb67e5

Contents?: true

Size: 733 Bytes

Versions: 6

Compression:

Stored size: 733 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 [:command_call, :call].include? statement.type
    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

6 entries across 6 versions & 1 rubygems

Version Path
yard-0.5.3 lib/yard/handlers/ruby/exception_handler.rb
yard-0.5.2 lib/yard/handlers/ruby/exception_handler.rb
yard-0.5.1p1 lib/yard/handlers/ruby/exception_handler.rb
yard-0.5.1 lib/yard/handlers/ruby/exception_handler.rb
yard-0.5.0 lib/yard/handlers/ruby/exception_handler.rb
yard-0.4.0 lib/yard/handlers/ruby/exception_handler.rb