Class: Dependabot::PreCommit::Helpers::Githelper
- Inherits:
-
Object
- Object
- Dependabot::PreCommit::Helpers::Githelper
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/pre_commit/helpers.rb
Instance Attribute Summary collapse
-
#credentials ⇒ Object
readonly
Returns the value of attribute credentials.
-
#dependency ⇒ Object
readonly
Returns the value of attribute dependency.
-
#ignored_versions ⇒ Object
readonly
Returns the value of attribute ignored_versions.
-
#raise_on_ignored ⇒ Object
readonly
Returns the value of attribute raise_on_ignored.
Instance Method Summary collapse
- #git_commit_checker ⇒ Object
- #git_commit_checker_for(source) ⇒ Object
-
#initialize(dependency:, credentials:, ignored_versions: [], raise_on_ignored: false, consider_version_branches_pinned: false, dependency_source_details: nil) ⇒ Githelper
constructor
A new instance of Githelper.
- #symbolize_source(source) ⇒ Object
Constructor Details
#initialize(dependency:, credentials:, ignored_versions: [], raise_on_ignored: false, consider_version_branches_pinned: false, dependency_source_details: nil) ⇒ Githelper
Returns a new instance of Githelper.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/dependabot/pre_commit/helpers.rb', line 27 def initialize( dependency:, credentials:, ignored_versions: [], raise_on_ignored: false, consider_version_branches_pinned: false, dependency_source_details: nil ) @dependency = dependency @credentials = credentials @ignored_versions = ignored_versions @raise_on_ignored = raise_on_ignored @consider_version_branches_pinned = consider_version_branches_pinned @dependency_source_details = dependency_source_details end |
Instance Attribute Details
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
47 48 49 |
# File 'lib/dependabot/pre_commit/helpers.rb', line 47 def credentials @credentials end |
#dependency ⇒ Object (readonly)
Returns the value of attribute dependency.
44 45 46 |
# File 'lib/dependabot/pre_commit/helpers.rb', line 44 def dependency @dependency end |
#ignored_versions ⇒ Object (readonly)
Returns the value of attribute ignored_versions.
50 51 52 |
# File 'lib/dependabot/pre_commit/helpers.rb', line 50 def ignored_versions @ignored_versions end |
#raise_on_ignored ⇒ Object (readonly)
Returns the value of attribute raise_on_ignored.
53 54 55 |
# File 'lib/dependabot/pre_commit/helpers.rb', line 53 def raise_on_ignored @raise_on_ignored end |
Instance Method Details
#git_commit_checker ⇒ Object
56 57 58 59 60 61 |
# File 'lib/dependabot/pre_commit/helpers.rb', line 56 def git_commit_checker @git_commit_checker ||= T.let( git_commit_checker_for(nil), T.nilable(Dependabot::GitCommitChecker) ) end |
#git_commit_checker_for(source) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/dependabot/pre_commit/helpers.rb', line 67 def git_commit_checker_for(source) @git_commit_checkers ||= T.let( {}, T.nilable( T::Hash[ T.nilable(Dependabot::DependencyRequirement::ObjectHash), Dependabot::GitCommitChecker ] ) ) @git_commit_checkers[source] ||= Dependabot::GitCommitChecker.new( dependency: dependency, credentials: credentials, ignored_versions: ignored_versions, raise_on_ignored: raise_on_ignored, consider_version_branches_pinned: @consider_version_branches_pinned, dependency_source_details: source ? symbolize_source(source) : @dependency_source_details ) end |
#symbolize_source(source) ⇒ Object
92 93 94 |
# File 'lib/dependabot/pre_commit/helpers.rb', line 92 def symbolize_source(source) source.to_h { |key, value| [key.to_sym, value] } end |