Class: Solargraph::Location
- Inherits:
-
Object
- Object
- Solargraph::Location
- Defined in:
- lib/solargraph/location.rb
Overview
A section of text identified by its filename and range.
Instance Attribute Summary collapse
- #filename ⇒ String readonly
- #range ⇒ Solargraph::Range readonly
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(filename, range) ⇒ Location
constructor
A new instance of Location.
- #inspect ⇒ Object
- #to_hash ⇒ Hash
Constructor Details
#initialize(filename, range) ⇒ Location
Returns a new instance of Location.
15 16 17 18 |
# File 'lib/solargraph/location.rb', line 15 def initialize filename, range @filename = filename @range = range end |
Instance Attribute Details
#filename ⇒ String (readonly)
8 9 10 |
# File 'lib/solargraph/location.rb', line 8 def filename @filename end |
#range ⇒ Solargraph::Range (readonly)
11 12 13 |
# File 'lib/solargraph/location.rb', line 11 def range @range end |
Instance Method Details
#==(other) ⇒ Object
28 29 30 31 |
# File 'lib/solargraph/location.rb', line 28 def == other return false unless other.is_a?(Location) filename == other.filename and range == other.range end |
#inspect ⇒ Object
33 34 35 |
# File 'lib/solargraph/location.rb', line 33 def inspect "#<#{self.class} #{filename}, #{range.inspect}>" end |
#to_hash ⇒ Hash
21 22 23 24 25 26 |
# File 'lib/solargraph/location.rb', line 21 def to_hash { filename: filename, range: range.to_hash } end |