Sha256: 2ad8a0bfd71f46a6a22247493b03e219a47c96c01ae9a534794a93bb4dd827db
Contents?: true
Size: 435 Bytes
Versions: 2
Compression:
Stored size: 435 Bytes
Contents
require 'rexml/document' require 'uri' module PRSS class Links def initialize(xml) @xml = ::REXML::Document.new(xml) end attr_reader :xml def links xml.elements.to_a('//item/link').tap do |links| puts "Found #{links.size} links" end end def each return to_enum unless block_given? links.each do |link| yield URI(link.text.strip) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
prss-0.2.2 | lib/prss/links.rb |
prss-0.2.1 | lib/prss/links.rb |