Class: Security::JobsFinder
- Inherits:
-
Object
- Object
- Security::JobsFinder
- Defined in:
- app/finders/security/jobs_finder.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#pipeline ⇒ Object
readonly
Returns the value of attribute pipeline.
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(pipeline:, job_types: []) ⇒ JobsFinder
constructor
A new instance of JobsFinder.
Constructor Details
#initialize(pipeline:, job_types: []) ⇒ JobsFinder
Returns a new instance of JobsFinder.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/finders/security/jobs_finder.rb', line 22 def initialize(pipeline:, job_types: []) if instance_of?(Security::JobsFinder) raise NotImplementedError, 'This is an abstract class, please instantiate its descendants' end if job_types.empty? @job_types = self.class.allowed_job_types elsif valid_job_types?(job_types) @job_types = job_types else raise ArgumentError, "job_types must be from the following: #{self.class.allowed_job_types}" end @pipeline = pipeline end |
Instance Attribute Details
#pipeline ⇒ Object (readonly)
Returns the value of attribute pipeline.
15 16 17 |
# File 'app/finders/security/jobs_finder.rb', line 15 def pipeline @pipeline end |
Class Method Details
.allowed_job_types ⇒ Object
17 18 19 20 |
# File 'app/finders/security/jobs_finder.rb', line 17 def self.allowed_job_types # Example return: [:sast, :dast, :dependency_scanning, :container_scanning, :license_scanning, :coverage_fuzzing] raise NotImplementedError, 'allowed_job_types must be overwritten to return an array of job types' end |
Instance Method Details
#execute ⇒ Object
38 39 40 41 42 |
# File 'app/finders/security/jobs_finder.rb', line 38 def execute return [] if @job_types.empty? find_jobs end |