lib/yard/lib/yard/code_objects/base.rb
def format_source(source)
        source.chomp!
        last = source.split(/\r?\n/).last
        indent = last ? last[/^([ \t]*)/, 1].length : 0
        source.gsub(/^[ \t]{#{indent}}/, '')
      end
# Formats source code by removing leading indentation
#
# @param [String] source the source code to format
# @return [String] formatted source
Formats source code by removing leading indentation
Formats source code by removing leading indentation
def format_source(source)
        source.chomp!
        last = source.split(/\r?\n/).last
        indent = last ? last[/^([ \t]*)/, 1].length : 0
        source.gsub(/^[ \t]{#{indent}}/, '')
      end
def format_source ( source ) source . chomp! last = source . split ( / \r ? \n / ) . last indent = last ? last [ / ^([  \t ]*) / , 1 ] . length : 0 source . gsub ( / ^[  \t ]{ #{ indent } } / , '' ) end
Formats source code by removing leading indentation
Formats source code by removing leading indentation
None
String
source
source the source code to format
source the source code to format