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