Class: RuboCop::Markdown::Position
- Inherits:
-
Object
- Object
- RuboCop::Markdown::Position
- Defined in:
- lib/rubocop/markdown/position.rb
Overview
Get 0-indexed position of the node from line and column based position.
Instance Method Summary collapse
- #index ⇒ Integer
-
#initialize(column:, content:, line:) ⇒ Position
constructor
A new instance of Position.
Constructor Details
#initialize(column:, content:, line:) ⇒ Position
Returns a new instance of Position.
10 11 12 13 14 15 16 17 18 |
# File 'lib/rubocop/markdown/position.rb', line 10 def initialize( column:, content:, line: ) @column = column @content = content @line = line end |
Instance Method Details
#index ⇒ Integer
21 22 23 |
# File 'lib/rubocop/markdown/position.rb', line 21 def index @content.lines[...@line].join.length + @column - 1 end |