class Sass::Source::Position - sass-3.4.14 Documentation

# class Sass::Source::Position

### Attributes

line[RW]

The one-based line of the document associated with the position.

@return [Fixnum]

offset[RW]

The one-based offset in the line of the document associated with the position.

@return [Fixnum]

### Public Class Methods

new(line, offset) click to toggle source

@param line [Fixnum] The source line @param offset [Fixnum] The source offset

    # File lib/sass/source/position.rb, line 16
    def initialize(line, offset)
      @line = line
      @offset = offset
    end

### Public Instance Methods

after(str) click to toggle source

@param str [String] The string to move through. @return [Position] The source position after proceeding forward through

    `str`.

    # File lib/sass/source/position.rb, line 29
    def after(str)
      newlines = str.count("\n")
      Position.new(line + newlines,
        if newlines == 0
          offset + str.length
        else
          str.length - str.rindex("\n") - 1
        end)
    end

inspect() click to toggle source

@return [String] A string representation of the source position.

    # File lib/sass/source/position.rb, line 22
    def inspect
      "#{line.inspect}:#{offset.inspect}"
    end