class TypeProf::CodePosition
Attributes
Public Class Methods
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/code_range.rb, line 8 def self.from_lsp(pos) new(pos[:line] + 1, pos[:character]) end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/code_range.rb, line 3 def initialize(lineno, column) @lineno = lineno @column = column end
Public Instance Methods
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/code_range.rb, line 18 def <=>(other) cmp = @lineno <=> other.lineno cmp == 0 ? @column <=> other.column : cmp end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/code_range.rb, line 25 def ==(other) @lineno == other.lineno && @column == other.column end
Also aliased as: eql?
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/code_range.rb, line 31 def hash [@lineno, @column].hash end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/code_range.rb, line 41 def left raise if @column == 0 CodePosition.new(@lineno, @column - 1) end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/code_range.rb, line 46 def right CodePosition.new(@lineno, @column + 1) end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/code_range.rb, line 12 def to_lsp { line: @lineno - 1, character: @column } end