source_extract(indentation = 0) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionpack/lib/action_view/template/error.rb, line 75
      def source_extract(indentation = 0)
        return unless num = line_number
        num = num.to_i

        source_code = @template.source.split("\n")

        start_on_line = [ num - SOURCE_CODE_RADIUS - 1, 0 ].max
        end_on_line   = [ num + SOURCE_CODE_RADIUS - 1, source_code.length].min

        indent = ' ' * indentation
        line_counter = start_on_line
        return unless source_code = source_code[start_on_line..end_on_line]

        source_code.sum do |line|
          line_counter += 1
          "#{indent}#{line_counter}: #{line}\n"
        end
      end
Register or log in to add new notes.