Class: RBS::Buffer
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/rbs/buffer.rb |
Class Method Summary
- .new(name:, content:) ⇒ Buffer constructor
Instance Attribute Summary
Instance Method Summary
Constructor Details
.new(name:, content:) ⇒ Buffer
Instance Attribute Details
#content (readonly)
[ GitHub ]# File 'lib/rbs/buffer.rb', line 4
attr_reader :content
#lines (readonly)
[ GitHub ]# File 'lib/rbs/buffer.rb', line 5
attr_reader :lines
#name (readonly)
[ GitHub ]# File 'lib/rbs/buffer.rb', line 3
attr_reader :name
#ranges (readonly)
[ GitHub ]# File 'lib/rbs/buffer.rb', line 6
attr_reader :ranges
Instance Method Details
#last_position
[ GitHub ]# File 'lib/rbs/buffer.rb', line 46
def last_position content.size end
#loc_to_pos(loc)
[ GitHub ]# File 'lib/rbs/buffer.rb', line 36
def loc_to_pos(loc) line, column = loc if range = ranges[line - 1] range.begin + column else last_position end end