Class: Bundler::LockfileParser::Position
- Inherits:
-
Object
- Object
- Bundler::LockfileParser::Position
- Defined in:
- lib/bundler/lockfile_parser.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
Instance Method Summary collapse
- #advance!(string) ⇒ Object
-
#initialize(line, column) ⇒ Position
constructor
A new instance of Position.
- #to_s ⇒ Object
Constructor Details
#initialize(line, column) ⇒ Position
Returns a new instance of Position.
7 8 9 10 |
# File 'lib/bundler/lockfile_parser.rb', line 7 def initialize(line, column) @line = line @column = column end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
6 7 8 |
# File 'lib/bundler/lockfile_parser.rb', line 6 def column @column end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
6 7 8 |
# File 'lib/bundler/lockfile_parser.rb', line 6 def line @line end |
Instance Method Details
#advance!(string) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# 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 ⇒ Object
22 23 24 |
# File 'lib/bundler/lockfile_parser.rb', line 22 def to_s "#{line}:#{column}" end |