Class: TypeProf::CodeRange
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/typeprof/code-range.rb |
Class Method Summary
Instance Attribute Summary
Instance Method Summary
Constructor Details
.new(first, last) ⇒ CodeRange
Class Method Details
.from_lsp(lsp_range)
[ GitHub ]# File 'lib/typeprof/code-range.rb', line 63
def self.from_lsp(lsp_range) CodeRange.new(CodeLocation.from_lsp(lsp[:start]), CodeLocation.from_lsp(lsp[:end])) end
.from_rbs(rbs_loc)
[ GitHub ]# File 'lib/typeprof/code-range.rb', line 67
def self.from_rbs(rbs_loc) CodeRange.new( CodeLocation.new(rbs_loc.start_line, rbs_loc.start_column), CodeLocation.new(rbs_loc.end_line, rbs_loc.end_column), ) end
Instance Attribute Details
#first (readonly)
[ GitHub ]# File 'lib/typeprof/code-range.rb', line 60
attr_reader :first
#last (readonly)
[ GitHub ]# File 'lib/typeprof/code-range.rb', line 61
attr_reader :last
Instance Method Details
#contain?(other) ⇒ Boolean
#contain_loc?(loc) ⇒ Boolean
# File 'lib/typeprof/code-range.rb', line 78
def contain_loc?(loc) @first <= loc && loc < @last end
#inspect
[ GitHub ]# File 'lib/typeprof/code-range.rb', line 56
def inspect "%p-%p" % [@first, @last] end
#overlap?(other) ⇒ Boolean
#to_lsp
[ GitHub ]# File 'lib/typeprof/code-range.rb', line 74
def to_lsp { start: @first.to_lsp, end: @last.to_lsp } end