Method: MethodSource::CodeHelpers#comment_describing
- Defined in:
- lib/method_source/code_helpers.rb
#comment_describing(file, line_number) ⇒ String
Retrieve the comment describing the expression on the given line of the given file.
This is useful to get module or method documentation.
52 53 54 55 56 |
# File 'lib/method_source/code_helpers.rb', line 52 def comment_describing(file, line_number) lines = file.is_a?(Array) ? file : file.each_line.to_a extract_last_comment(lines[0..(line_number - 2)]) end |