Module: DocStrings::Extensions::Base::MethodExtension
- Defined in:
- lib/docstrings/extensions/base.rb
Instance Method Summary collapse
Instance Method Details
#docstring ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/docstrings/extensions/base.rb', line 5 def docstring path, line_number = source_location if path && File.exists?(path) file = File.read(path) # FIXME: This will work terribly for large files if file =~ Regexp.new(%Q{\\A(?:.*?\n){#{line_number}}\s*?"""([\\s\\S]+?)"""}) $1.gsub(/\n\s+/, "\n").strip end end end |