Class: Hudson::Parser::JobInfo
- Inherits:
-
Object
- Object
- Hudson::Parser::JobInfo
- Defined in:
- lib/hudson-remote-api/parser/job_info.rb
Instance Attribute Summary collapse
-
#xml ⇒ Object
Returns the value of attribute xml.
-
#xml_doc ⇒ Object
Returns the value of attribute xml_doc.
Instance Method Summary collapse
- #builds ⇒ Object
- #color ⇒ Object
- #free_style_project? ⇒ Boolean
-
#initialize(raw_xml) ⇒ JobInfo
constructor
A new instance of JobInfo.
- #last_build ⇒ Object
- #last_completed_build ⇒ Object
- #last_failed_build ⇒ Object
- #last_stable_build ⇒ Object
- #last_successful_build ⇒ Object
- #last_unsuccessful_build ⇒ Object
- #next_build_number ⇒ Object
Constructor Details
#initialize(raw_xml) ⇒ JobInfo
Returns a new instance of JobInfo.
6 7 8 9 |
# File 'lib/hudson-remote-api/parser/job_info.rb', line 6 def initialize(raw_xml) @xml = raw_xml @xml_doc = REXML::Document.new(raw_xml) end |
Instance Attribute Details
#xml ⇒ Object
Returns the value of attribute xml.
4 5 6 |
# File 'lib/hudson-remote-api/parser/job_info.rb', line 4 def xml @xml end |
#xml_doc ⇒ Object
Returns the value of attribute xml_doc.
4 5 6 |
# File 'lib/hudson-remote-api/parser/job_info.rb', line 4 def xml_doc @xml_doc end |
Instance Method Details
#builds ⇒ Object
11 12 13 14 15 |
# File 'lib/hudson-remote-api/parser/job_info.rb', line 11 def builds Array.new().tap do |a| self.xml_doc.elements.each("/freeStyleProject/build"){|e| a << e.elements["number"].text } unless self.xml_doc.elements["/freeStyleProject/build"].nil? end end |
#color ⇒ Object
17 18 19 20 |
# File 'lib/hudson-remote-api/parser/job_info.rb', line 17 def color color_elem = self.xml_doc.elements["/freeStyleProject/color"] color_elem.text if free_style_project? && color_elem end |
#free_style_project? ⇒ Boolean
22 23 24 |
# File 'lib/hudson-remote-api/parser/job_info.rb', line 22 def free_style_project? !self.xml_doc.elements["/freeStyleProject"].nil? end |
#last_build ⇒ Object
26 27 28 |
# File 'lib/hudson-remote-api/parser/job_info.rb', line 26 def last_build read_elem_text("/freeStyleProject/lastBuild/number") if free_style_project? end |
#last_completed_build ⇒ Object
30 31 32 |
# File 'lib/hudson-remote-api/parser/job_info.rb', line 30 def last_completed_build read_elem_text("/freeStyleProject/lastCompletedBuild/number") if free_style_project? end |
#last_failed_build ⇒ Object
34 35 36 |
# File 'lib/hudson-remote-api/parser/job_info.rb', line 34 def last_failed_build read_elem_text("/freeStyleProject/lastFailedBuild/number") if free_style_project? end |
#last_stable_build ⇒ Object
38 39 40 |
# File 'lib/hudson-remote-api/parser/job_info.rb', line 38 def last_stable_build read_elem_text("/freeStyleProject/lastStableBuild/number") if free_style_project? end |
#last_successful_build ⇒ Object
42 43 44 |
# File 'lib/hudson-remote-api/parser/job_info.rb', line 42 def last_successful_build read_elem_text("/freeStyleProject/lastSuccessfulBuild/number") if free_style_project? end |
#last_unsuccessful_build ⇒ Object
46 47 48 |
# File 'lib/hudson-remote-api/parser/job_info.rb', line 46 def last_unsuccessful_build read_elem_text("/freeStyleProject/lastUnsuccessfulBuild/number") if free_style_project? end |
#next_build_number ⇒ Object
50 51 52 |
# File 'lib/hudson-remote-api/parser/job_info.rb', line 50 def next_build_number read_elem_text("/freeStyleProject/nextBuildNumber") if free_style_project? end |