Class: Feedjira::Parser::Podcast

Inherits:
Object
  • Object
show all
Includes:
FeedUtilities, Feedjira::Podcast::XML::Required, SAXMachine
Defined in:
lib/feedjira/parser/podcast.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Feedjira::Podcast::XML::Required

included

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_sym, *arguments, &block) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/feedjira/parser/podcast.rb', line 25

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

Class Method Details

.able_to_parse?(xml) ⇒ Boolean

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

Returns:

  • (Boolean)


19
20
21
22
23
# File 'lib/feedjira/parser/podcast.rb', line 19

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

.respond_to_missing?(method_sym, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
36
37
38
39
# File 'lib/feedjira/parser/podcast.rb', line 33

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