class TypeProf::CodePosition
属性
column[R]
lineno[R]
公共类方法
from_lsp(pos) 点击切换源代码
# 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) 点击切换源代码
# File typeprof-0.30.1/lib/typeprof/code_range.rb, line 3 def initialize(lineno, column) @lineno = lineno @column = column end
公共实例方法
<=>(other) 点击切换源代码
# 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) 点击切换源代码
# File typeprof-0.30.1/lib/typeprof/code_range.rb, line 25 def ==(other) @lineno == other.lineno && @column == other.column end
也别名为:eql?
hash() 点击切换源代码
# File typeprof-0.30.1/lib/typeprof/code_range.rb, line 31 def hash [@lineno, @column].hash end
left() 点击切换源代码
# 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() 点击切换源代码
# File typeprof-0.30.1/lib/typeprof/code_range.rb, line 46 def right CodePosition.new(@lineno, @column + 1) end
to_lsp() 点击切换源代码
# File typeprof-0.30.1/lib/typeprof/code_range.rb, line 12 def to_lsp { line: @lineno - 1, character: @column } end
to_s() 点击切换源代码
# File typeprof-0.30.1/lib/typeprof/code_range.rb, line 35 def to_s "(%d,%d)" % [@lineno, @column] end
也别名为:inspect