class Solargraph::Range

def self.from_expr expr

def self.from_expr expr
  from_to(expr.line, expr.column, expr.last_line, expr.last_column)
end

def self.from_node node

def self.from_node node
  from_expr(node.loc.expression)
end

def self.from_to l1, c1, l2, c2

Returns:
  • (Range) -

Parameters:
  • c2 (Integer) -- Ending character
  • l2 (Integer) -- Ending line
  • c1 (Integer) -- Starting character
  • l1 (Integer) -- Starting line
def self.from_to l1, c1, l2, c2
  Range.new(Position.new(l1, c1), Position.new(l2, c2))
end

def == other

def == other
  return false unless other.is_a?(Range)
  start == other.start and ending == other.ending
end

def contain? position

Returns:
  • (Boolean) -

Parameters:
  • position (Solargraph::Position) --
def contain? position
  return false if position.line < start.line or position.line > ending.line
  return false if position.line == start.line and position.character < start.character
  return false if position.line == ending.line and position.character > ending.character
  true
end

def include? position

Returns:
  • (Boolean) -

Parameters:
  • position (Position) --
def include? position
  contain?(position) and !(position.line == start.line and position.character == start.character)
end

def initialize start, ending

Parameters:
  • ending (Position) --
  • start (Position) --
def initialize start, ending
  @start = start
  @ending = ending
end

def to_hash

Returns:
  • (Hash) -
def to_hash
  {
    start: start.to_hash,
    end: ending.to_hash
  }
end