Class: LeeroyJenkins::JobFinder
- Inherits:
-
Object
- Object
- LeeroyJenkins::JobFinder
- Defined in:
- lib/leeroy_jenkins/job_finder.rb
Instance Attribute Summary collapse
-
#jenkins_client ⇒ Object
readonly
Returns the value of attribute jenkins_client.
Instance Method Summary collapse
- #find_jobs(regex, job_names = []) ⇒ Object
-
#initialize(jenkins_client) ⇒ JobFinder
constructor
A new instance of JobFinder.
Constructor Details
#initialize(jenkins_client) ⇒ JobFinder
Returns a new instance of JobFinder.
5 6 7 |
# File 'lib/leeroy_jenkins/job_finder.rb', line 5 def initialize(jenkins_client) @jenkins_client = jenkins_client end |
Instance Attribute Details
#jenkins_client ⇒ Object (readonly)
Returns the value of attribute jenkins_client.
3 4 5 |
# File 'lib/leeroy_jenkins/job_finder.rb', line 3 def jenkins_client @jenkins_client end |
Instance Method Details
#find_jobs(regex, job_names = []) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/leeroy_jenkins/job_finder.rb', line 9 def find_jobs(regex, job_names = []) jobs_matching_regex = jenkins_client.job.list(regex) if job_names.any? jobs_matching_regex.select do |job| job_names.include? job end else jobs_matching_regex end end |