Class: Solargraph::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/solargraph/location.rb

Overview

A section of text identified by its filename and range.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename, range) ⇒ Location


13
14
15
16
# File 'lib/solargraph/location.rb', line 13

def initialize filename, range
  @filename = filename
  @range = range
end

Instance Attribute Details

#filenameString (readonly)


6
7
8
# File 'lib/solargraph/location.rb', line 6

def filename
  @filename
end

#rangeSolargraph::Range (readonly)


9
10
11
# File 'lib/solargraph/location.rb', line 9

def range
  @range
end

Instance Method Details

#==(other) ⇒ Object


26
27
28
29
# File 'lib/solargraph/location.rb', line 26

def == other
  return false unless other.is_a?(Location)
  filename == other.filename and range == other.range
end

#inspectObject


31
32
33
# File 'lib/solargraph/location.rb', line 31

def inspect
  "#<#{self.class} #{filename}, #{range.inspect}>"
end

#to_hashHash


19
20
21
22
23
24
# File 'lib/solargraph/location.rb', line 19

def to_hash
  {
    filename: filename,
    range: range.to_hash
  }
end