Class: TFSGraph::RepositoryRegistry
- Inherits:
-
Object
- Object
- TFSGraph::RepositoryRegistry
- Includes:
- Singleton, Extensions
- Defined in:
- lib/tfs_graph/repository_registry.rb
Constant Summary collapse
- TYPES =
%w(branch changeset project)
Class Method Summary collapse
Instance Method Summary collapse
- #identifier ⇒ Object
-
#initialize ⇒ RepositoryRegistry
constructor
A new instance of RepositoryRegistry.
- #reset! ⇒ Object
- #type(type) ⇒ Object
Methods included from Extensions
Constructor Details
#initialize ⇒ RepositoryRegistry
Returns a new instance of RepositoryRegistry.
19 20 21 |
# File 'lib/tfs_graph/repository_registry.rb', line 19 def initialize reset! end |
Class Method Details
.register {|instance| ... } ⇒ Object
11 12 13 14 15 16 17 |
# 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 |
Instance Method Details
#identifier ⇒ Object
31 32 33 |
# File 'lib/tfs_graph/repository_registry.rb', line 31 def identifier (@base_repo.name =~ /Neo4j/i) ? "neo4j" : "redis" end |
#reset! ⇒ Object
23 24 25 26 27 28 29 |
# 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) ⇒ Object
35 36 37 |
# File 'lib/tfs_graph/repository_registry.rb', line 35 def type(type) @base_repo = type end |