Sha256: 10f233873aac744f96c98ba08405a58956c981b789932fbde28a42160c4d3004

Contents?: true

Size: 413 Bytes

Versions: 2

Compression:

Stored size: 413 Bytes

Contents

require 'nokogiri'

module PRSS
  class Links
    def initialize(xml)
      @xml = xml
    end

    def channel
      @channel ||= Nokogiri::XML.parse(@xml).xpath('//channel')
    end

    def links
      channel.xpath('//item/link').tap do |links|
        puts "Found #{links.size} links"
      end
    end

    def each(&block)
      links.each do |link|
        yield link.content
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
prss-0.1.1 lib/prss/links.rb
prss-0.1.0 lib/prss/links.rb