Module: Solargraph::Pin::Localized

Included in:
LocalVariable
Defined in:
lib/solargraph/pin/localized.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#presenceRange (readonly)


5
6
7
# File 'lib/solargraph/pin/localized.rb', line 5

def presence
  @presence
end

Instance Method Details

#visible_at?(other_loc) ⇒ Boolean


20
21
22
23
# File 'lib/solargraph/pin/localized.rb', line 20

def visible_at?(other_loc)
  return false if location.filename != other_loc.filename
  presence.include?(other_loc.range.start)
end

#visible_from?(other, position) ⇒ Boolean


10
11
12
13
14
15
16
17
# File 'lib/solargraph/pin/localized.rb', line 10

def visible_from?(other, position)
  position = Position.normalize(position)
  other.filename == filename and
    (other == closure ||
      (closure.location.range.contain?(closure.location.range.start) && closure.location.range.contain?(other.location.range.ending))
    ) &&
    presence.contain?(position)
end