Sha256: b297dc4942c5d22225b0cf7da45ffbaa3571503d04323f054391849abc59c611
Contents?: true
Size: 840 Bytes
Versions: 7
Compression:
Stored size: 840 Bytes
Contents
module Yoda module Commands # Provide parsing methods of positon representation with the format `path/to/file:line_num:character_num` module FileCursorParsable private # Returns a cursor literal to parse. # @abstract # @return [String] def filename_with_position fail NotImplementedError end # @return [String, nil] represents the filename part. def filename @filename ||= filename_with_position.split(':').first end # Parse location part of cursor literal and returns the parsed location. # @return [Parsing::Location] 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 end end end
Version data entries
7 entries across 7 versions & 1 rubygems