.bundle/ruby/2.0.0/gems/kramdown-1.4.1/lib/kramdown/utils/string_scanner.rb
def current_line_number
        # Not using string[@previous_pos..best_pos].count('\n') because it is slower
        strscan = ::StringScanner.new(string)
        strscan.pos = @previous_pos
        old_pos = pos + 1
        @previous_line_number += 1 while strscan.skip_until(/\n/) && strscan.pos <= old_pos

        @previous_pos = (eos? ? best_pos : best_pos + 1)
        @previous_line_number
      end
# Returns the line number for current charpos.
#
# NOTE: Requires that all line endings are normalized to '\n'
#
# NOTE: Normally we'd have to add one to the count of newlines to get the correct line number.
# However we add the one indirectly by using a one-based start_line_number.
Returns the line number for current charpos.
NOTE: Requires that all line endings are normalized to '\n'

Normally we'd have to add one to the count of newlines to get the correct line number.
However we add the one indirectly by using a one-based start_line_number.
Returns the line number for current charpos . NOTE : Requires that all line endings are normalized to ' \ n ' Normally we ' d have to add one to the count of newlines to get the correct line number . However we add the one indirectly by using a one - based start_line_number .
def current_line_number
        strscan = ::StringScanner.new(string)
        strscan.pos = @previous_pos
        old_pos = pos + 1
        @previous_line_number += 1 while strscan.skip_until(/\n/) && strscan.pos <= old_pos
        @previous_pos = (eos? ? best_pos : best_pos + 1)
        @previous_line_number
      end
def current_line_number strscan = :: StringScanner . new ( string ) strscan . pos = @previous_pos old_pos = pos + 1 @previous_line_number += 1 while strscan . skip_until ( / \n / ) && strscan . pos <= old_pos @previous_pos = ( eos? ? best_pos : best_pos + 1 ) @previous_line_number end
Returns the line number for current charpos.
Returns the line number for current charpos .
# Not using string[@previous_pos..best_pos].count('\n') because it is slower