Class: MetzScan::ProjectIndex

Inherits:
Object
  • Object
show all
Defined in:
lib/metz_scan/project_index.rb,
lib/metz_scan/project_index/null_backend.rb,
lib/metz_scan/project_index/rubydex_backend.rb,
lib/metz_scan/project_index/rubydex_backend/file_discovery.rb,
lib/metz_scan/project_index/rubydex_backend/location_formatting.rb,
lib/metz_scan/project_index/rubydex_backend/method_declarations.rb

Overview

Thin facade over optional project-wide indexes used by future analyzers.

Defined Under Namespace

Classes: Declaration, MethodDeclaration, NullBackend, Reference, RubydexBackend, UnavailableBackendError, UnknownBackendError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(backend) ⇒ ProjectIndex

Returns a new instance of ProjectIndex.



55
56
57
# File 'lib/metz_scan/project_index.rb', line 55

def initialize(backend)
  @backend = backend
end

Instance Attribute Details

#backendObject (readonly)

Returns the value of attribute backend.



59
60
61
# File 'lib/metz_scan/project_index.rb', line 59

def backend
  @backend
end

Class Method Details

.build(paths, backend: :auto, workspace: false) ⇒ Object



20
21
22
23
24
25
# File 'lib/metz_scan/project_index.rb', line 20

def self.build(paths, backend: :auto, workspace: false)
  backend = backend.to_sym
  raise UnknownBackendError, "unknown project index backend: #{backend}" unless BACKENDS.include?(backend)

  new(build_backend(Array(paths), backend, workspace))
end

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/metz_scan/project_index.rb', line 65

def available?
  backend.available?
end

#backend_nameObject



61
62
63
# File 'lib/metz_scan/project_index.rb', line 61

def backend_name
  backend.name
end

#constant_references_to(name) ⇒ Object



101
102
103
# File 'lib/metz_scan/project_index.rb', line 101

def constant_references_to(name)
  backend.constant_references_to(name)
end

#declarationsObject



85
86
87
# File 'lib/metz_scan/project_index.rb', line 85

def declarations
  backend.declarations
end

#descendants_of(name) ⇒ Object



97
98
99
# File 'lib/metz_scan/project_index.rb', line 97

def descendants_of(name)
  backend.descendants_of(name)
end

#diagnosticsObject



81
82
83
# File 'lib/metz_scan/project_index.rb', line 81

def diagnostics
  backend.diagnostics
end

#documentsObject



93
94
95
# File 'lib/metz_scan/project_index.rb', line 93

def documents
  backend.documents
end

#index_errorsObject



77
78
79
# File 'lib/metz_scan/project_index.rb', line 77

def index_errors
  backend.index_errors
end

#indexed_filesObject



73
74
75
# File 'lib/metz_scan/project_index.rb', line 73

def indexed_files
  backend.indexed_files
end

#method_declarationsObject



89
90
91
# File 'lib/metz_scan/project_index.rb', line 89

def method_declarations
  backend.method_declarations
end

#reasonObject



69
70
71
# File 'lib/metz_scan/project_index.rb', line 69

def reason
  backend.reason
end

#search(query) ⇒ Object



105
106
107
# File 'lib/metz_scan/project_index.rb', line 105

def search(query)
  backend.search(query)
end