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.
9 10 11 12 |
# File 'lib/bundler/lockfile_parser.rb', line 9 def initialize(line, column) @line = line @column = column end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
8 9 10 |
# File 'lib/bundler/lockfile_parser.rb', line 8 def column @column end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
8 9 10 |
# File 'lib/bundler/lockfile_parser.rb', line 8 def line @line end |
Instance Method Details
#advance!(string) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/bundler/lockfile_parser.rb', line 14 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
24 25 26 |
# File 'lib/bundler/lockfile_parser.rb', line 24 def to_s "#{line}:#{column}" end |