123456789_123456789_123456789_123456789_123456789_

Class: Bundler::LockfileParser::Position

Relationships & Source Files
Inherits: Object
Defined in: lib/bundler/lockfile_parser.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(line, column) ⇒ Position

[ GitHub ]

  
# File 'lib/bundler/lockfile_parser.rb', line 7

def initialize(line, column)
  @line = line
  @column = column
end

Instance Attribute Details

#column (readonly)

[ GitHub ]

  
# File 'lib/bundler/lockfile_parser.rb', line 6

attr_reader :line, :column

#line (readonly)

[ GitHub ]

  
# File 'lib/bundler/lockfile_parser.rb', line 6

attr_reader :line, :column

Instance Method Details

#advance!(string)

[ GitHub ]

  
# File 'lib/bundler/lockfile_parser.rb', line 12

def advance!(string)
  lines = string.count("\n")
  if lines > 0
    @line += lines
    @column = string.length - string.rindex("\n")
  else
    @column += string.length
  end
end

#to_s

[ GitHub ]

  
# File 'lib/bundler/lockfile_parser.rb', line 22

def to_s
  "#{line}:#{column}"
end