Class: GitHooks::PreCommit::PreventDebugger

Inherits:
Object
  • Object
show all
Defined in:
lib/git_hooks/pre_commit/prevent_debugger.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(git_repository) ⇒ PreventDebugger

Returns a new instance of PreventDebugger.



10
11
12
# File 'lib/git_hooks/pre_commit/prevent_debugger.rb', line 10

def initialize(git_repository)
  @git_repository = git_repository
end

Instance Attribute Details

#git_repositoryObject (readonly)

Returns the value of attribute git_repository.



4
5
6
# File 'lib/git_hooks/pre_commit/prevent_debugger.rb', line 4

def git_repository
  @git_repository
end

Class Method Details

.validateObject



6
7
8
# File 'lib/git_hooks/pre_commit/prevent_debugger.rb', line 6

def self.validate(*)
  new(GitHooks.configurations.git_repository).validate
end

Instance Method Details

#validateObject



14
15
16
17
18
# File 'lib/git_hooks/pre_commit/prevent_debugger.rb', line 14

def validate
  abort(
    "Prevented commit with debugger in #{files_with_debugger}"
  ) if files_with_debugger.any?
end