Class: CruiseStatus::CruiseRbParser
- Inherits:
-
FeedParser
- Object
- FeedParser
- CruiseStatus::CruiseRbParser
- Defined in:
- lib/cruisestatus/cruise_rb_parser.rb
Instance Attribute Summary collapse
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
Methods inherited from FeedParser
Constructor Details
This class inherits a constructor from CruiseStatus::FeedParser
Instance Attribute Details
#url ⇒ Object
Returns the value of attribute url.
8 9 10 |
# File 'lib/cruisestatus/cruise_rb_parser.rb', line 8 def url @url end |
Instance Method Details
#check ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/cruisestatus/cruise_rb_parser.rb', line 10 def check project_feed = @feed.read @doc = REXML::Document.new project_feed rescue Exception => e @failures = [e.] @doc = REXML::Document.new "" end |
#failures ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/cruisestatus/cruise_rb_parser.rb', line 18 def failures @failures ||= REXML::XPath.match( @doc, "//item/title" ).select { |element| element.text =~ /failed$/ }.map do |element| element.text.gsub( /(.*) build (.+) failed$/, '\1' ) end end |