module Yoda::Commands::FileCursorParsable
Provide parsing methods of positon representation with the format `path/to/file:line_num:character_num`
Private Instance Methods
filename()
click to toggle source
@return [String, nil] represents the filename part.
# File lib/yoda/commands/file_cursor_parsable.rb, line 15 def filename @filename ||= filename_with_position.split(':').first end
filename_with_position()
click to toggle source
Returns a cursor literal to parse. @abstract @return [String]
# File lib/yoda/commands/file_cursor_parsable.rb, line 10 def filename_with_position fail NotImplementedError end
position()
click to toggle source
Parse location part of cursor literal and returns the parsed location. @return [Parsing::Location]
# File lib/yoda/commands/file_cursor_parsable.rb, line 21 def position @position ||= begin row, column = filename_with_position.split(':').slice(1..2) Parsing::Location.new(row: row.to_i, column: column.to_i) end end