Class: DtkCommon::GitRepo
- Inherits:
-
Object
- Object
- DtkCommon::GitRepo
show all
- Defined in:
- lib/git_repo.rb,
lib/git_repo/adapters/rugged.rb
Direct Known Subclasses
Branch
Defined Under Namespace
Classes: Adapter, Branch
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(repo_path) ⇒ GitRepo
Returns a new instance of GitRepo.
9
10
11
12
|
# File 'lib/git_repo.rb', line 9
def initialize(repo_path)
@repo_path = repo_path
@adapters = Hash.new
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/git_repo.rb', line 25
def method_missing(method_name,*args,&block)
if adapter_name = self.class.find_adapter_name(method_name)
adapter = (@adapters[adapter_name] ||= Hash.new)[branch_index()] ||= self.class.load_and_return_adapter_class(adapter_name).new(*adapter_initialize_args())
execution_wrapper do
adapter.send(method_name,*args,&block)
end
else
super
end
end
|
Class Method Details
.implements_method?(method_name) ⇒ Boolean
41
42
43
|
# File 'lib/git_repo.rb', line 41
def self.implements_method?(method_name)
!!find_adapter_name(method_name)
end
|
Instance Method Details
#respond_to?(method_name) ⇒ Boolean
37
38
39
|
# File 'lib/git_repo.rb', line 37
def respond_to?(method_name)
super(method_name) or self.class.find_adapter_name(method_name)
end
|