In Files

  • rss/parser.rb

Class/Module Index [+]

Quicksearch

RSS::Parser

Public Class Methods

default_parser() click to toggle source
 
               # File rss/parser.rb, line 60
def default_parser
  @@default_parser || AVAILABLE_PARSERS.first
end
            
default_parser=(new_value) click to toggle source

Set @@default_parser to new_value if it is one of the available parsers. Else raise NotValidXMLParser error.

 
               # File rss/parser.rb, line 66
def default_parser=(new_value)
  if AVAILABLE_PARSERS.include?(new_value)
    @@default_parser = new_value
  else
    raise NotValidXMLParser.new(new_value)
  end
end
            
new(rss, parser_class=self.class.default_parser) click to toggle source
 
               # File rss/parser.rb, line 106
def initialize(rss, parser_class=self.class.default_parser)
  @parser = parser_class.new(normalize_rss(rss))
end
            
parse(rss, *args) click to toggle source
 
               # File rss/parser.rb, line 74
def parse(rss, *args)
  if args.last.is_a?(Hash)
    options = args.pop
  else
    options = {}
  end
  do_validate = boolean_argument(args[0], options[:validate], true)
  ignore_unknown_element =
    boolean_argument(args[1], options[:ignore_unknown_element], true)
  parser_class = args[2] || options[:parser_class] || default_parser
  parser = new(rss, parser_class)
  parser.do_validate = do_validate
  parser.ignore_unknown_element = ignore_unknown_element
  parser.parse
end