Sha256: aae5ea0f494d7d0d4b81565fd25439ec5c39b1582e9e3a30bef9b7a078709634

Contents?: true

Size: 348 Bytes

Versions: 3

Compression:

Stored size: 348 Bytes

Contents

require 'nokogiri'

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

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

    def links
      channel.xpath('//item/link')
    end

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

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prss-0.0.4 lib/prss/parser.rb
prss-0.0.3 lib/prss/parser.rb
prss-0.0.2 lib/prss/parser.rb