Class: GitHooks::PreCommit::PreventMaster
- Inherits:
-
Object
- Object
- GitHooks::PreCommit::PreventMaster
- Defined in:
- lib/git_hooks/pre_commit/prevent_master.rb
Instance Attribute Summary collapse
-
#git_repository ⇒ Object
readonly
Returns the value of attribute git_repository.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(git_repository) ⇒ PreventMaster
constructor
A new instance of PreventMaster.
- #validate ⇒ Object
Constructor Details
#initialize(git_repository) ⇒ PreventMaster
Returns a new instance of PreventMaster.
10 11 12 |
# File 'lib/git_hooks/pre_commit/prevent_master.rb', line 10 def initialize(git_repository) @git_repository = git_repository end |
Instance Attribute Details
#git_repository ⇒ Object (readonly)
Returns the value of attribute git_repository.
4 5 6 |
# File 'lib/git_hooks/pre_commit/prevent_master.rb', line 4 def git_repository @git_repository end |
Class Method Details
.validate ⇒ Object
6 7 8 |
# File 'lib/git_hooks/pre_commit/prevent_master.rb', line 6 def self.validate new(GitHooks.configurations.git_repository).validate end |
Instance Method Details
#validate ⇒ Object
14 15 16 |
# File 'lib/git_hooks/pre_commit/prevent_master.rb', line 14 def validate abort 'Prevented to commit on master' if on_master? end |