module YARD::Templates::Helpers::MethodHelper

def format_code(object, _show_lines = false)

Returns:
  • (String) - formats source of an object
def format_code(object, _show_lines = false)
  i = -1
  lines = object.source.split(/\n/)
  longestline = (object.line + lines.size).to_s.length
  lines.map do |line|
    lineno = object.line + (i += 1)
    (" " * (longestline - lineno.to_s.length)) + lineno.to_s + "    " + line
  end.join("\n")
end