Sha256: 6e18ee3bc967bbcc0040ec58abfc48194f6d1086a36e459f0693702749b07e47

Contents?: true

Size: 437 Bytes

Versions: 4

Compression:

Stored size: 437 Bytes

Contents

require 'lamppost/version'
require 'feedjira/opml'

module Lamppost
  class OPML
    def initialize(file_or_xml)
      @xml = file_or_xml.is_a?(File) ? file_or_xml.read : file_or_xml
    end

    def head
      @head ||= document.head
    end

    def outlines
      @outlines ||= document.body.outlines
    end

    private

    def document
      @document ||= Feedjira::Feed.parse_with(Feedjira::Parser::OPML, @xml)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lamppost-2.0.1 lib/lamppost.rb
lamppost-2.0.0 lib/lamppost.rb
lamppost-1.0.1 lib/lamppost.rb
lamppost-1.0.0 lib/lamppost.rb