class RubyDetective::SourceRepresentation::DataStore
Attributes
classes[RW]
constants[RW]
Public Class Methods
new()
click to toggle source
# File lib/ruby_detective/source_representation/data_store.rb, line 12 def initialize @classes = [] @constants = [] end
Public Instance Methods
clear!()
click to toggle source
# File lib/ruby_detective/source_representation/data_store.rb, line 21 def clear! initialize end
inspect()
click to toggle source
# File lib/ruby_detective/source_representation/data_store.rb, line 25 def inspect "#<RubyDetective::SourceRepresentation::DataStore>" end
query()
click to toggle source
# File lib/ruby_detective/source_representation/data_store.rb, line 17 def query Query.new end
register_class(name, namespace, inheritance_class_name:, file_path:, first_line:, last_line:)
click to toggle source
# File lib/ruby_detective/source_representation/data_store.rb, line 33 def register_class(name, namespace, inheritance_class_name:, file_path:, first_line:, last_line:) klass = Entities::Klass.new( name, namespace, inheritance_class_name: inheritance_class_name, file_path: file_path, first_line: first_line, last_line: last_line ) existing_class = query.classes(where: { path: klass.path }).first if existing_class existing_class.merge(klass) existing_class else @classes << klass klass end end
register_constant(name, namespace, file_path:, caller:, refers_to: nil)
click to toggle source
# File lib/ruby_detective/source_representation/data_store.rb, line 54 def register_constant(name, namespace, file_path:, caller:, refers_to: nil) constant = Entities::Constant.new( name, namespace, caller: caller, refers_to: refers_to, file_path: file_path ) @constants << constant constant end
resolve_dependencies()
click to toggle source
# File lib/ruby_detective/source_representation/data_store.rb, line 29 def resolve_dependencies DependencyResolver.resolve_and_populate_store end