Sha256: 8a41d5726671dc224b3d58dfe638329e410ac773272d94c2b3108cad40f05052

Contents?: true

Size: 481 Bytes

Versions: 14

Compression:

Stored size: 481 Bytes

Contents

require 'hpricot'

module Jkl
  module Rss
    class << self

      def items(rss_doc)
        (rss_doc/:item)
      end
      
      def links(items)
        items.map{|item| attribute_from(item,:link)}
      end

      def descriptions(items)
        items.map do |item| 
          attribute_from(item, :description).gsub("<![CDATA[","").gsub("]]>","")
        end
      end

      def attribute_from(item, name)
        (item/name).inner_html
      end
      
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
jakal-0.1.96 lib/jkl/rss_client.rb
jakal-0.1.95 lib/jkl/rss_client.rb
jakal-0.1.94 lib/jkl/rss_client.rb
jakal-0.1.93 lib/jkl/rss_client.rb
jakal-0.1.92 lib/jkl/rss_client.rb
jakal-0.1.91 lib/jkl/rss_client.rb
jakal-0.1.9 lib/jkl/rss_client.rb
jakal-0.1.8 lib/jkl/rss_client.rb
jakal-0.1.7 lib/jkl/rss_client.rb
jakal-0.1.6 lib/jkl/rss_client.rb
jakal-0.1.5 lib/jkl/rss_client.rb
jakal-0.1.4 lib/jkl/rss_client.rb
jakal-0.1.3 lib/jkl/rss_client.rb
jakal-0.1.2 lib/jkl/rss_client.rb