Sha256: 5d746218cc9a64670c4ea35b5c595bf9693dba5526a6842821b18488bc0b7ea5
Contents?: true
Size: 1003 Bytes
Versions: 43
Compression:
Stored size: 1003 Bytes
Contents
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
Version data entries
43 entries across 43 versions & 5 rubygems