Class: FeedMe::FeedParser
- Inherits:
-
AbstractParser
- Object
- AbstractParser
- FeedMe::FeedParser
- Defined in:
- lib/feed_me/feed_parser.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from AbstractParser
Class Method Summary collapse
- .open(file) ⇒ Object
-
.parse(feed) ⇒ Object
parses the passed feed and identifeis what kind of feed it is then returns a parser object.
Methods inherited from AbstractParser
Constructor Details
This class inherits a constructor from FeedMe::AbstractParser
Class Method Details
.open(file) ⇒ Object
9 10 11 |
# File 'lib/feed_me/feed_parser.rb', line 9 def open(file) self.parse(Kernel.open(file).read) end |
.parse(feed) ⇒ Object
parses the passed feed and identifeis what kind of feed it is then returns a parser object
15 16 17 18 19 20 21 22 |
# File 'lib/feed_me/feed_parser.rb', line 15 def parse(feed) xml = Hpricot.XML(feed) root_node, format = self.identify(xml) raise InvalidFeedFormat if format.nil? self.build(root_node, format) end |