Class: GitSniffer::Base
- Inherits:
-
Object
show all
- Includes:
- Lazy
- Defined in:
- lib/git_sniffer/base.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Lazy
included
Constructor Details
#initialize(git_path) ⇒ Base
Returns a new instance of Base.
14
15
16
|
# File 'lib/git_sniffer/base.rb', line 14
def initialize(git_path)
@path = git_path
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_id, *args, &block) ⇒ Object
49
50
51
52
53
|
# File 'lib/git_sniffer/base.rb', line 49
def method_missing(method_id, *args, &block)
types = ["blobs", "commits", "trees"]
return type_objects(method_id.to_s.singularize, args[0]) if types.include? method_id.to_s
super
end
|
Instance Attribute Details
Returns the value of attribute path.
11
12
13
|
# File 'lib/git_sniffer/base.rb', line 11
def path
@path
end
|
Class Method Details
.open(git_path) ⇒ Object
35
36
37
|
# File 'lib/git_sniffer/base.rb', line 35
def open(git_path)
Base.new(git_path)
end
|
Instance Method Details
#exec(command) ⇒ Object
18
19
20
|
# File 'lib/git_sniffer/base.rb', line 18
def exec(command)
`git --git-dir=#{@path} #{command}`
end
|
#object(sha) ⇒ Object
22
23
24
|
# File 'lib/git_sniffer/base.rb', line 22
def object(sha)
sha_objects[sha]
end
|
30
31
32
|
# File 'lib/git_sniffer/base.rb', line 30
def objects
sha_objects.values
end
|
26
27
28
|
# File 'lib/git_sniffer/base.rb', line 26
def shas
sha_objects.keys
end
|