Sha256: 831a64b66ba8335d2d4f0ba9e1f8d2b7ab91990db59ff54ee2ea4c8169fa41ab

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

module Feedjira
  module Parser
    class Podcast
      include SAXMachine
      include FeedUtilities

      include ::Feedjira::Podcast::XML::Required

      # def parse(xml_input, on_error = nil, on_warning = nil)
      #   # TODO This is fragile
      #   @namespaces = {}
      #   Nokogiri::XML(xml_input).xpath("//namespace::*").each do |ns|
      #     @namespaces[ns.href] = ns.prefix
      #   end
      #
      #   super xml_input
      # end

      def self.able_to_parse?(xml)
        # TODO Look for any of several podcast-specific matches, especially
        # to cover feeds that may not have any items yet
        (/\<rss|\<rdf/ =~ xml) && (/enclosure/ =~ xml)
      end

      def method_missing(method_sym, *arguments, &block)
        if rss && rss.channel && rss.channel.respond_to?(method_sym)
          rss.channel.send(method_sym, *arguments, &block)
        else
          super
        end
      end

      def self.respond_to_missing?(method_sym, include_private = false)
        if rss && rss.channel && rss.channel.respond_to?(method_sym)
          true
        else
          super
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
feedjira-podcast-0.10.0 lib/feedjira/parser/podcast.rb