In Files

  • rbs-2.1.0/lib/rbs/location_aux.rb

Class/Module Index [+]

Quicksearch

RBS::Location

Constants

WithChildren

Public Class Methods

new(buffer_ = nil, start_pos_ = nil, end_pos_ = nil, buffer: nil, start_pos: nil, end_pos: nil) click to toggle source
 
               # File rbs-2.1.0/lib/rbs/location_aux.rb, line 9
def self.new(buffer_ = nil, start_pos_ = nil, end_pos_ = nil, buffer: nil, start_pos: nil, end_pos: nil)
  __skip__ =
    begin
      if buffer && start_pos && end_pos
        super(buffer, start_pos, end_pos)
      else
        super(buffer_, start_pos_, end_pos_)
      end
    end
end
            

Public Instance Methods

==(other) click to toggle source
 
               # File rbs-2.1.0/lib/rbs/location_aux.rb, line 68
def ==(other)
  other.is_a?(Location) &&
    other.buffer == buffer &&
    other.start_pos == start_pos &&
    other.end_pos == end_pos
end
            
end_column() click to toggle source
 
               # File rbs-2.1.0/lib/rbs/location_aux.rb, line 40
def end_column
  end_loc[1]
end
            
end_line() click to toggle source
 
               # File rbs-2.1.0/lib/rbs/location_aux.rb, line 36
def end_line
  end_loc[0]
end
            
end_loc() click to toggle source
 
               # File rbs-2.1.0/lib/rbs/location_aux.rb, line 50
def end_loc
  @end_loc ||= begin
    _end_loc || buffer.pos_to_loc(end_pos)
  end
end
            
inspect() click to toggle source
 
               # File rbs-2.1.0/lib/rbs/location_aux.rb, line 3
def inspect
  rks = each_required_key.to_a
  ops = each_optional_key.to_a.map {|x| "?#{x}" }
  "#<#{self.class}:#{self.__id__} buffer=#{buffer.name}, start=#{start_line}:#{start_column}, pos=#{start_pos}...#{end_pos}, children=#{(rks + ops).join(",")} source='#{source.lines.first&.chomp}'>"
end
            
name() click to toggle source
 
               # File rbs-2.1.0/lib/rbs/location_aux.rb, line 24
def name
  buffer.name
end
            
range() click to toggle source
 
               # File rbs-2.1.0/lib/rbs/location_aux.rb, line 56
def range
  @range ||= start_pos...end_pos
end
            
source() click to toggle source
 
               # File rbs-2.1.0/lib/rbs/location_aux.rb, line 60
def source
  @source ||= buffer.content[range] or raise
end
            
start_column() click to toggle source
 
               # File rbs-2.1.0/lib/rbs/location_aux.rb, line 32
def start_column
  start_loc[1]
end
            
start_line() click to toggle source
 
               # File rbs-2.1.0/lib/rbs/location_aux.rb, line 28
def start_line
  start_loc[0]
end
            
start_loc() click to toggle source
 
               # File rbs-2.1.0/lib/rbs/location_aux.rb, line 44
def start_loc
  @start_loc ||= begin
    _start_loc || buffer.pos_to_loc(start_pos)
  end
end
            
to_json(state = _ = nil) click to toggle source
 
               # File rbs-2.1.0/lib/rbs/location_aux.rb, line 75
def to_json(state = _ = nil)
  {
    start: {
      line: start_line,
      column: start_column
    },
    end
            
to_s() click to toggle source
 
               # File rbs-2.1.0/lib/rbs/location_aux.rb, line 64
def to_s
  "#{name || "-"}:#{start_line}:#{start_column}...#{end_line}:#{end_column}"
end
            
There is an updated format of the API docs for this version here.