class TFSGraph::RepositoryRegistry

Constants

TYPES

Public Class Methods

new() click to toggle source
# File lib/tfs_graph/repository_registry.rb, line 19
def initialize
  reset!
end
register() { |instance| ... } click to toggle source
# File lib/tfs_graph/repository_registry.rb, line 11
def self.register
  # assume re-registering means we want to clear existing repos
  instance.reset!
  yield instance if block_given?

  instance
end

Public Instance Methods

identifier() click to toggle source
# File lib/tfs_graph/repository_registry.rb, line 31
def identifier
  (@base_repo.name =~ /Neo4j/i) ? "neo4j" : "redis"
end
reset!() click to toggle source
# File lib/tfs_graph/repository_registry.rb, line 23
def reset!
  @base_repo = nil

  TYPES.each do |type|
    instance_variable_set repo_memo(type), nil
  end
end
type(type) click to toggle source
# File lib/tfs_graph/repository_registry.rb, line 35
def type(type)
  @base_repo = type
end

Private Instance Methods

repo_memo(type) click to toggle source
# File lib/tfs_graph/repository_registry.rb, line 56
def repo_memo(type)
  "@#{type}_repo"
end