Class: GitHooks::Git
- Inherits:
-
Object
- Object
- GitHooks::Git
- Extended by:
- Forwardable
- Defined in:
- lib/git_hooks/git.rb
Instance Attribute Summary collapse
-
#working_folder ⇒ Object
readonly
Returns the value of attribute working_folder.
Instance Method Summary collapse
- #added_or_modified ⇒ Object
- #clean? ⇒ Boolean
-
#initialize(working_folder) ⇒ Git
constructor
A new instance of Git.
- #repository ⇒ Object
Constructor Details
#initialize(working_folder) ⇒ Git
Returns a new instance of Git.
11 12 13 |
# File 'lib/git_hooks/git.rb', line 11 def initialize(working_folder) @working_folder = working_folder end |
Instance Attribute Details
#working_folder ⇒ Object (readonly)
Returns the value of attribute working_folder.
7 8 9 |
# File 'lib/git_hooks/git.rb', line 7 def working_folder @working_folder end |
Instance Method Details
#added_or_modified ⇒ Object
19 20 21 22 23 24 |
# File 'lib/git_hooks/git.rb', line 19 def added_or_modified added = repository.status.added modified = repository.status.changed added.merge(modified).keys end |
#clean? ⇒ Boolean
26 27 28 |
# File 'lib/git_hooks/git.rb', line 26 def clean? (added_files + modified_files + deleted_files + untracked_files).empty? end |
#repository ⇒ Object
15 16 17 |
# File 'lib/git_hooks/git.rb', line 15 def repository ::Git.open(working_folder) end |