Class: ThemeCheck::Position
- Inherits:
-
Object
- Object
- ThemeCheck::Position
show all
- Includes:
- PositionHelper
- Defined in:
- lib/theme_check/position.rb
Instance Method Summary
collapse
#bounded, #from_index_to_row_column, #from_row_column_to_index
Constructor Details
#initialize(needle, contents, line_number_1_indexed) ⇒ Position
Returns a new instance of Position.
7
8
9
10
11
12
13
|
# File 'lib/theme_check/position.rb', line 7
def initialize(needle, contents, line_number_1_indexed)
@needle = needle
@contents = contents
@line_number_1_indexed = line_number_1_indexed
@start_row_column = nil
@end_row_column = nil
end
|
Instance Method Details
#end_column ⇒ Object
41
42
43
|
# File 'lib/theme_check/position.rb', line 41
def end_column
end_row_column[1]
end
|
#end_index ⇒ Object
25
26
27
|
# File 'lib/theme_check/position.rb', line 25
def end_index
start_index + needle.size
end
|
#end_row ⇒ Object
37
38
39
|
# File 'lib/theme_check/position.rb', line 37
def end_row
end_row_column[0]
end
|
#start_column ⇒ Object
33
34
35
|
# File 'lib/theme_check/position.rb', line 33
def start_column
start_row_column[1]
end
|
#start_index ⇒ Object
20
21
22
|
# File 'lib/theme_check/position.rb', line 20
def start_index
contents.index(needle, start_line_index) || start_line_index
end
|
#start_line_index ⇒ Object
15
16
17
|
# File 'lib/theme_check/position.rb', line 15
def start_line_index
from_row_column_to_index(contents, line_number, 0)
end
|
#start_row ⇒ Object
29
30
31
|
# File 'lib/theme_check/position.rb', line 29
def start_row
start_row_column[0]
end
|