lib/chapex/source.rb
# get row and column on source. they begin with 0.
# if index is outbound, return -1 about row and column.
#
# @param [Fixnum] :index target
# @return [Fixnum, Fixnum] row and column
get row and column on source. they begin with 0.
if index is outbound, return -1 about row and column.
get row and column on source . they begin with 0 . if index is outbound return - 1 about row and column .
def position(index)
      return [-1, -1] unless index < string.length
      row_start = @line_starts.select { |line_start| line_start <= index }.last
      row = @line_starts.index(row_start)
      column = index - row_start
      [row, column]
    end
def position ( index ) return [ - 1 , - 1 ] unless index < string . length row_start = @line_starts . select { | line_start | line_start <= index } . last row = @line_starts . index ( row_start ) column = index - row_start [ row , column ] end
get row and column on source.
get row and column on source .
row and column
row and column
Fixnum, Fixnum
index
<not_specific>
<not_specific>
None