Method: MethodExtensions::MethodSourceWithDoc#doc

Defined in:
lib/method_extensions/method/source_with_doc.rb

#docObject

Returns comment preceding the method definition by parsing the file returned by ‘Method#source_location`

Sample IRB session:

ruby-1.9.2-head > require 'fileutils'

ruby-1.9.2-head > puts FileUtils.method(:mkdir).doc
#
# Options: mode noop verbose
#
# Creates one or more directories.
#
#   FileUtils.mkdir 'test'
#   FileUtils.mkdir %w( tmp data )
#   FileUtils.mkdir 'notexist', :noop => true  # Does not really create.
#   FileUtils.mkdir 'tmp', :mode => 0700
#


53
54
55
# File 'lib/method_extensions/method/source_with_doc.rb', line 53

def doc
  MethodDocRipper.doc_from_source_location(source_location)
end