HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/share/rubygems-integration/all/gems/sass-3.7.4/lib/sass/source/position.rb
module Sass::Source
  class Position
    # The one-based line of the document associated with the position.
    #
    # @return [Integer]
    attr_accessor :line

    # The one-based offset in the line of the document associated with the
    # position.
    #
    # @return [Integer]
    attr_accessor :offset

    # @param line [Integer] The source line
    # @param offset [Integer] The source offset
    def initialize(line, offset)
      @line = line
      @offset = offset
    end

    # @return [String] A string representation of the source position.
    def inspect
      "#{line.inspect}:#{offset.inspect}"
    end

    # @param str [String] The string to move through.
    # @return [Position] The source position after proceeding forward through
    #   `str`.
    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
  end
end