Class: Solargraph::Arc::Convention

Inherits:
Convention::Base
  • Object
show all
Defined in:
lib/solargraph-arc.rb

Instance Method Summary collapse

Instance Method Details

#global(yard_map) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/solargraph-arc.rb', line 24

def global yard_map
  Solargraph::Environ.new(
    pins: Solargraph::Arc::RailsApi.instance.global(yard_map)
  )
rescue => error
  Solargraph.logger.warn(error.message + "\n" + error.backtrace.join("\n"))
  EMPTY_ENVIRON
end

#local(source_map) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/solargraph-arc.rb', line 33

def local source_map
  pins = []
  ds   = source_map.document_symbols.select {|n| n.is_a?(Solargraph::Pin::Namespace) }
  ns   = ds.first

  return EMPTY_ENVIRON unless ns

  pins += run_feature { Schema.instance.process(source_map, ns) }
  pins += run_feature { Relation.instance.process(source_map, ns) }
  pins += run_feature { Storage.instance.process(source_map, ns) }
  pins += run_feature { Autoload.instance.process(source_map, ns, ds) }
  pins += run_feature { Devise.instance.process(source_map, ns) }
  pins += run_feature { Delegate.instance.process(source_map, ns) }
  pins += run_feature { RailsApi.instance.local(source_map, ns) }

  Solargraph::Environ.new(pins: pins)
end