Module: RSS::ListenerMixin (Ruby 2.2.2)
Description: Module : RSS::ListenerMixin - Ruby 2.2.2

- Home
- Core 2.2.2
- Std-lib 2.2.2
- Downloads

Support for the Ruby 2.2 series has ended. See here for reference.

### Home Classes Methods

### In Files

- rss/0.9.rb
- rss/1.0.rb
- rss/atom.rb
- rss/parser.rb

### Methods

- ::new
- #instruction
- #tag_end
- #tag_start
- #text
- #xmldecl

### Class/Module Index

Quicksearch

- RSS
- RSS::Atom
- RSS::Atom::CommonModel
- RSS::Atom::ContentModel
- RSS::Atom::ContentModel::ClassMethods
- RSS::Atom::DateConstruct
- RSS::Atom::DuplicateLinkChecker
- RSS::Atom::Entry
- RSS::Atom::Feed
- RSS::Atom::Feed::Author
- RSS::Atom::Feed::Category
- RSS::Atom::Feed::Contributor
- RSS::Atom::Feed::Entry
- RSS::Atom::Feed::Entry::Content
- RSS::Atom::Feed::Entry::Published
- RSS::Atom::Feed::Entry::Source
- RSS::Atom::Feed::Entry::Summary
- RSS::Atom::Feed::Generator
- RSS::Atom::Feed::Icon
- RSS::Atom::Feed::Id
- RSS::Atom::Feed::Link
- RSS::Atom::Feed::Logo
- RSS::Atom::Feed::Rights
- RSS::Atom::Feed::Subtitle
- RSS::Atom::Feed::Title
- RSS::Atom::Feed::Updated
- RSS::Atom::PersonConstruct
- RSS::Atom::PersonConstruct::Email
- RSS::Atom::PersonConstruct::Name
- RSS::Atom::PersonConstruct::Uri
- RSS::Atom::TextConstruct
- RSS::Atom::URIContentModel
- RSS::BaseDublinCoreModel
- RSS::BaseListener
- RSS::BaseModel
- RSS::BaseParser
- RSS::ContentModel
- RSS::ConversionError
- RSS::Converter
- RSS::DublinCoreModel
- RSS::DublincoreModel
- RSS::Element
- RSS::Error
- RSS::ITunesBaseModel
- RSS::ITunesChannelModel
- RSS::ITunesChannelModel::ITunesCategory
- RSS::ITunesChannelModel::ITunesImage
- RSS::ITunesChannelModel::ITunesOwner
- RSS::ITunesItemModel
- RSS::ITunesItemModel::ITunesDuration
- RSS::ITunesModelUtils
- RSS::ImageFaviconModel
- RSS::ImageFaviconModel::ImageFavicon
- RSS::ImageItemModel
- RSS::ImageItemModel::ImageItem
- RSS::ImageModelUtils
- RSS::InvalidRSSError
- RSS::ListenerMixin
- RSS::Maker
- RSS::Maker::Atom
- RSS::Maker::Atom::Entry
- RSS::Maker::Atom::Entry::Channel
- RSS::Maker::Atom::Entry::Channel::Cloud
- RSS::Maker::Atom::Entry::Channel::Description
- RSS::Maker::Atom::Entry::Channel::Generator
- RSS::Maker::Atom::Entry::Channel::SkipDays
- RSS::Maker::Atom::Entry::Channel::SkipDays::Day
- RSS::Maker::Atom::Entry::Channel::SkipHours
- RSS::Maker::Atom::Entry::Channel::SkipHours::Hour
- RSS::Maker::Atom::Entry::Image
- RSS::Maker::Atom::Entry::Items
- RSS::Maker::Atom::Entry::Items::Item
- RSS::Maker::Atom::Entry::Textinput
- RSS::Maker::Atom::Feed
- RSS::Maker::Atom::Feed::Channel
- RSS::Maker::Atom::Feed::Channel::Categories
- RSS::Maker::Atom::Feed::Channel::Categories::Category
- RSS::Maker::Atom::Feed::Channel::Cloud
- RSS::Maker::Atom::Feed::Channel::Generator
- RSS::Maker::Atom::Feed::Channel::Links
- RSS::Maker::Atom::Feed::Channel::Links::Link
- RSS::Maker::Atom::Feed::Channel::SkipDays
- RSS::Maker::Atom::Feed::Channel::SkipDays::Day
- RSS::Maker::Atom::Feed::Channel::SkipHours
- RSS::Maker::Atom::Feed::Channel::SkipHours::Hour
- RSS::Maker::Atom::Feed::Image
- RSS::Maker::Atom::Feed::Items
- RSS::Maker::Atom::Feed::Items::Item
- RSS::Maker::Atom::Feed::Items::Item::Categories
- RSS::Maker::Atom::Feed::Items::Item::Categories::Category
- RSS::Maker::Atom::Feed::Items::Item::Content
- RSS::Maker::Atom::Feed::Items::Item::Enclosure
- RSS::Maker::Atom::Feed::Items::Item::Guid
- RSS::Maker::Atom::Feed::Items::Item::Links
- RSS::Maker::Atom::Feed::Items::Item::Links::Link
- RSS::Maker::Atom::Feed::Items::Item::Source
- RSS::Maker::Atom::Feed::Items::Item::Source::Categories
- RSS::Maker::Atom::Feed::Items::Item::Source::Categories::Category
- RSS::Maker::Atom::Feed::Items::Item::Source::Generator
- RSS::Maker::Atom::Feed::Items::Item::Source::Icon
- RSS::Maker::Atom::Feed::Items::Item::Source::Links
- RSS::Maker::Atom::Feed::Items::Item::Source::Links::Link
- RSS::Maker::Atom::Feed::Items::Item::Source::Logo
- RSS::Maker::Atom::Feed::Textinput
- RSS::Maker::AtomCategory
- RSS::Maker::AtomGenerator
- RSS::Maker::AtomLink
- RSS::Maker::AtomLogo
- RSS::Maker::AtomPersonConstructBase
- RSS::Maker::AtomPersons
- RSS::Maker::AtomTextConstruct
- RSS::Maker::AtomTextConstructBase
- RSS::Maker::AtomTextConstructBase::EnsureXMLContent
- RSS::Maker::Base
- RSS::Maker::ChannelBase
- RSS::Maker::ChannelBase::AuthorsBase
- RSS::Maker::ChannelBase::AuthorsBase::AuthorBase
- RSS::Maker::ChannelBase::CategoriesBase
- RSS::Maker::ChannelBase::CategoriesBase::CategoryBase
- RSS::Maker::ChannelBase::CloudBase
- RSS::Maker::ChannelBase::ContributorsBase
- RSS::Maker::ChannelBase::ContributorsBase::ContributorBase
- RSS::Maker::ChannelBase::CopyrightBase
- RSS::Maker::ChannelBase::DescriptionBase
- RSS::Maker::ChannelBase::GeneratorBase
- RSS::Maker::ChannelBase::ITunesCategories
- RSS::Maker::ChannelBase::ITunesCategories::ITunesCategory
- RSS::Maker::ChannelBase::ITunesImage
- RSS::Maker::ChannelBase::ITunesOwner
- RSS::Maker::ChannelBase::LinksBase
- RSS::Maker::ChannelBase::LinksBase::LinkBase
- RSS::Maker::ChannelBase::SkipDaysBase
- RSS::Maker::ChannelBase::SkipDaysBase::DayBase
- RSS::Maker::ChannelBase::SkipHoursBase
- RSS::Maker::ChannelBase::SkipHoursBase::HourBase
- RSS::Maker::ChannelBase::TitleBase
- RSS::Maker::ContentModel
- RSS::Maker::DublinCoreModel
- RSS::Maker::ITunesBaseModel
- RSS::Maker::ITunesChannelModel
- RSS::Maker::ITunesChannelModel::ITunesCategoriesBase
- RSS::Maker::ITunesChannelModel::ITunesCategoriesBase::ITunesCategoryBase
- RSS::Maker::ITunesChannelModel::ITunesImageBase
- RSS::Maker::ITunesChannelModel::ITunesOwnerBase
- RSS::Maker::ITunesItemModel
- RSS::Maker::ITunesItemModel::ITunesDurationBase
- RSS::Maker::ImageBase
- RSS::Maker::ImageFaviconModel
- RSS::Maker::ImageFaviconModel::ImageFaviconBase
- RSS::Maker::ImageItemModel
- RSS::Maker::ImageItemModel::ImageItemBase
- RSS::Maker::ItemsBase
- RSS::Maker::ItemsBase::ItemBase
- RSS::Maker::ItemsBase::ItemBase::ContentBase
- RSS::Maker::ItemsBase::ItemBase::DescriptionBase
- RSS::Maker::ItemsBase::ItemBase::EnclosureBase
- RSS::Maker::ItemsBase::ItemBase::GuidBase
- RSS::Maker::ItemsBase::ItemBase::ITunesDuration
- RSS::Maker::ItemsBase::ItemBase::RightsBase
- RSS::Maker::ItemsBase::ItemBase::SourceBase
- RSS::Maker::ItemsBase::ItemBase::SourceBase::IconBase
- RSS::Maker::ItemsBase::ItemBase::SourceBase::LogoBase
- RSS::Maker::ItemsBase::ItemBase::SourceBase::RightsBase
- RSS::Maker::ItemsBase::ItemBase::SourceBase::SubtitleBase
- RSS::Maker::ItemsBase::ItemBase::SourceBase::TitleBase
- RSS::Maker::ItemsBase::ItemBase::TitleBase
- RSS::Maker::RSS09
- RSS::Maker::RSS091
- RSS::Maker::RSS091::Channel
- RSS::Maker::RSS091::Image
- RSS::Maker::RSS091::Items
- RSS::Maker::RSS091::Items::Item
- RSS::Maker::RSS091::Textinput
- RSS::Maker::RSS092
- RSS::Maker::RSS092::Channel
- RSS::Maker::RSS092::Image
- RSS::Maker::RSS092::Items
- RSS::Maker::RSS092::Items::Item
- RSS::Maker::RSS092::Textinput
- RSS::Maker::RSS09::Channel
- RSS::Maker::RSS09::Channel::Authors
- RSS::Maker::RSS09::Channel::Authors::Author
- RSS::Maker::RSS09::Channel::Categories
- RSS::Maker::RSS09::Channel::Categories::Category
- RSS::Maker::RSS09::Channel::Cloud
- RSS::Maker::RSS09::Channel::Contributors
- RSS::Maker::RSS09::Channel::Contributors::Contributor
- RSS::Maker::RSS09::Channel::Copyright
- RSS::Maker::RSS09::Channel::Description
- RSS::Maker::RSS09::Channel::Generator
- RSS::Maker::RSS09::Channel::Links
- RSS::Maker::RSS09::Channel::Links::Link
- RSS::Maker::RSS09::Channel::SkipDays
- RSS::Maker::RSS09::Channel::SkipDays::Day
- RSS::Maker::RSS09::Channel::SkipHours
- RSS::Maker::RSS09::Channel::SkipHours::Hour
- RSS::Maker::RSS09::Channel::Title
- RSS::Maker::RSS09::Image
- RSS::Maker::RSS09::Items
- RSS::Maker::RSS09::Items::Item
- RSS::Maker::RSS09::Items::Item::Authors
- RSS::Maker::RSS09::Items::Item::Authors::Author
- RSS::Maker::RSS09::Items::Item::Categories
- RSS::Maker::RSS09::Items::Item::Categories::Category
- RSS::Maker::RSS09::Items::Item::Content
- RSS::Maker::RSS09::Items::Item::Contributors
- RSS::Maker::RSS09::Items::Item::Contributors::Contributor
- RSS::Maker::RSS09::Items::Item::Description
- RSS::Maker::RSS09::Items::Item::Enclosure
- RSS::Maker::RSS09::Items::Item::Guid
- RSS::Maker::RSS09::Items::Item::Links
- RSS::Maker::RSS09::Items::Item::Links::Link
- RSS::Maker::RSS09::Items::Item::Rights
- RSS::Maker::RSS09::Items::Item::Source
- RSS::Maker::RSS09::Items::Item::Source::Authors
- RSS::Maker::RSS09::Items::Item::Source::Authors::Author
- RSS::Maker::RSS09::Items::Item::Source::Categories
- RSS::Maker::RSS09::Items::Item::Source::Categories::Category
- RSS::Maker::RSS09::Items::Item::Source::Contributors
- RSS::Maker::RSS09::Items::Item::Source::Contributors::Contributor
- RSS::Maker::RSS09::Items::Item::Source::Generator
- RSS::Maker::RSS09::Items::Item::Source::Icon
- RSS::Maker::RSS09::Items::Item::Source::Links
- RSS::Maker::RSS09::Items::Item::Source::Links::Link
- RSS::Maker::RSS09::Items::Item::Source::Logo
- RSS::Maker::RSS09::Items::Item::Source::Rights
- RSS::Maker::RSS09::Items::Item::Source::Subtitle
- RSS::Maker::RSS09::Items::Item::Source::Title
- RSS::Maker::RSS09::Items::Item::Title
- RSS::Maker::RSS09::Textinput
- RSS::Maker::RSS10
- RSS::Maker::RSS10::Channel
- RSS::Maker::RSS10::Channel::Authors
- RSS::Maker::RSS10::Channel::Authors::Author
- RSS::Maker::RSS10::Channel::Categories
- RSS::Maker::RSS10::Channel::Categories::Category
- RSS::Maker::RSS10::Channel::Cloud
- RSS::Maker::RSS10::Channel::Contributors
- RSS::Maker::RSS10::Channel::Contributors::Contributor
- RSS::Maker::RSS10::Channel::Copyright
- RSS::Maker::RSS10::Channel::Description
- RSS::Maker::RSS10::Channel::Generator
- RSS::Maker::RSS10::Channel::Links
- RSS::Maker::RSS10::Channel::Links::Link
- RSS::Maker::RSS10::Channel::SkipDays
- RSS::Maker::RSS10::Channel::SkipDays::Day
- RSS::Maker::RSS10::Channel::SkipHours
- RSS::Maker::RSS10::Channel::SkipHours::Hour
- RSS::Maker::RSS10::Channel::Title
- RSS::Maker::RSS10::Image
- RSS::Maker::RSS10::Items
- RSS::Maker::RSS10::Items::Item
- RSS::Maker::RSS10::Items::Item::Authors
- RSS::Maker::RSS10::Items::Item::Authors::Author
- RSS::Maker::RSS10::Items::Item::Categories
- RSS::Maker::RSS10::Items::Item::Categories::Category
- RSS::Maker::RSS10::Items::Item::Content
- RSS::Maker::RSS10::Items::Item::Contributors
- RSS::Maker::RSS10::Items::Item::Contributors::Contributor
- RSS::Maker::RSS10::Items::Item::Description
- RSS::Maker::RSS10::Items::Item::Enclosure
- RSS::Maker::RSS10::Items::Item::Guid
- RSS::Maker::RSS10::Items::Item::Links
- RSS::Maker::RSS10::Items::Item::Links::Link
- RSS::Maker::RSS10::Items::Item::Rights
- RSS::Maker::RSS10::Items::Item::Source
- RSS::Maker::RSS10::Items::Item::Source::Authors
- RSS::Maker::RSS10::Items::Item::Source::Authors::Author
- RSS::Maker::RSS10::Items::Item::Source::Categories
- RSS::Maker::RSS10::Items::Item::Source::Categories::Category
- RSS::Maker::RSS10::Items::Item::Source::Contributors
- RSS::Maker::RSS10::Items::Item::Source::Contributors::Contributor
- RSS::Maker::RSS10::Items::Item::Source::Generator
- RSS::Maker::RSS10::Items::Item::Source::Icon
- RSS::Maker::RSS10::Items::Item::Source::Links
- RSS::Maker::RSS10::Items::Item::Source::Links::Link
- RSS::Maker::RSS10::Items::Item::Source::Logo
- RSS::Maker::RSS10::Items::Item::Source::Rights
- RSS::Maker::RSS10::Items::Item::Source::Subtitle
- RSS::Maker::RSS10::Items::Item::Source::Title
- RSS::Maker::RSS10::Items::Item::Title
- RSS::Maker::RSS10::Textinput
- RSS::Maker::RSS20
- RSS::Maker::RSS20::Channel
- RSS::Maker::RSS20::Channel::Categories
- RSS::Maker::RSS20::Channel::Categories::Category
- RSS::Maker::RSS20::Channel::Cloud
- RSS::Maker::RSS20::Channel::Generator
- RSS::Maker::RSS20::Channel::SkipDays
- RSS::Maker::RSS20::Channel::SkipDays::Day
- RSS::Maker::RSS20::Channel::SkipHours
- RSS::Maker::RSS20::Channel::SkipHours::Hour
- RSS::Maker::RSS20::Image
- RSS::Maker::RSS20::Items
- RSS::Maker::RSS20::Items::Item
- RSS::Maker::RSS20::Items::Item::Authors
- RSS::Maker::RSS20::Items::Item::Authors::Author
- RSS::Maker::RSS20::Items::Item::Categories
- RSS::Maker::RSS20::Items::Item::Categories::Category
- RSS::Maker::RSS20::Items::Item::Enclosure
- RSS::Maker::RSS20::Items::Item::Guid
- RSS::Maker::RSS20::Items::Item::Source
- RSS::Maker::RSS20::Items::Item::Source::Links
- RSS::Maker::RSS20::Items::Item::Source::Links::Link
- RSS::Maker::RSS20::Textinput
- RSS::Maker::RSSBase
- RSS::Maker::SetupDefaultDate
- RSS::Maker::SetupDefaultLanguage
- RSS::Maker::SlashModel
- RSS::Maker::SyndicationModel
- RSS::Maker::TaxonomyTopicModel
- RSS::Maker::TaxonomyTopicModel::TaxonomyTopicsBase
- RSS::Maker::TaxonomyTopicModel::TaxonomyTopicsBase::TaxonomyTopicBase
- RSS::Maker::TaxonomyTopicsModel
- RSS::Maker::TaxonomyTopicsModel::TaxonomyTopicsBase
- RSS::Maker::TextinputBase
- RSS::Maker::TrackBackModel
- RSS::Maker::TrackBackModel::TrackBackAboutsBase
- RSS::Maker::TrackBackModel::TrackBackAboutsBase::TrackBackAboutBase
- RSS::Maker::XMLStyleSheets
- RSS::Maker::XMLStyleSheets::XMLStyleSheet
- RSS::MissingAttributeError
- RSS::MissingTagError
- RSS::NSError
- RSS::NotAvailableValueError
- RSS::NotExpectedTagError
- RSS::NotSetError
- RSS::NotValidXMLParser
- RSS::NotWellFormedError
- RSS::OverlappedPrefixError
- RSS::Parser
- RSS::RDF::Bag
- RSS::RDF::Bag::Li
- RSS::RDF::Channel
- RSS::RDF::Channel::Image
- RSS::RDF::Channel::Items
- RSS::RDF::Channel::Items::Seq
- RSS::RDF::Channel::Textinput
- RSS::RDF::Image
- RSS::RDF::Li
- RSS::RDF::Seq
- RSS::RDF::Seq::Li
- RSS::RDF::Textinput
- RSS::REXMLLikeXMLParser
- RSS::REXMLListener
- RSS::REXMLParser
- RSS::RSS09
- RSS::RSS10
- RSS::RootElementMixin
- RSS::Rss::Channel::Cloud
- RSS::Rss::Channel::Image
- RSS::Rss::Channel::Item::Category
- RSS::Rss::Channel::Item::Enclosure
- RSS::Rss::Channel::Item::Guid
- RSS::Rss::Channel::Item::Source
- RSS::Rss::Channel::SkipDays
- RSS::Rss::Channel::SkipDays::Day
- RSS::Rss::Channel::SkipHours
- RSS::Rss::Channel::SkipHours::Hour
- RSS::Rss::Channel::TextInput
- RSS::SetupMaker
- RSS::SlashModel
- RSS::SyndicationModel
- RSS::TaxonomyTopicModel
- RSS::TaxonomyTopicModel::TaxonomyTopic
- RSS::TaxonomyTopicsModel
- RSS::TaxonomyTopicsModel::TaxonomyTopics
- RSS::TaxonomyTopicsModel::TaxonomyTopics::Bag
- RSS::TooMuchTagError
- RSS::UnknownConversionMethodError
- RSS::UnknownTagError
- RSS::UnsupportedMakerVersionError
- RSS::Utils
- RSS::Utils::CSV
- RSS::Utils::InheritedReader
- RSS::Utils::YesCleanOther
- RSS::Utils::YesOther
- RSS::XML
- RSS::XML::Element
- RSS::XMLParserListener
- RSS::XMLParserNotFound
- RSS::XMLParserParser
- RSS::XMLScanListener
- RSS::XMLScanParser
- RSS::XMLStyleSheet
- RSS::XMLStyleSheetMixin
- Time
- XML
- XML::Parser
- XMLEncoding_ja
- XMLEncoding_ja::SJISHandler

No matching classes.

# RSS::ListenerMixin

### Constants

CONTENT_PATTERN
NAMESPLIT

### Attributes

do_validate[RW]
ignore_unknown_element[RW]
rss[R]

### Public Class Methods

new() click to toggle source

                   # File rss/parser.rb, line 267
    def initialize
      @rss = nil
      @ignore_unknown_element = true
      @do_validate = true
      @ns_stack = [{"xml" => :xml}]
      @tag_stack = [[]]
      @text_stack = ['']
      @proc_stack = []
      @last_element = nil
      @version = @encoding = @standalone = nil
      @xml_stylesheets = []
      @xml_child_mode = false
      @xml_element = nil
      @last_xml_element = nil
    end

### Public Instance Methods

instruction(name, content) click to toggle source

                   # File rss/parser.rb, line 288
    def instruction(name, content)
      if name == "xml-stylesheet"
        params = parse_pi_content(content)
        if params.has_key?("href")
          @xml_stylesheets << XMLStyleSheet.new(params)
        end
      end
    end

tag_end(name) click to toggle source

                   # File rss/parser.rb, line 350
    def tag_end(name)
      if DEBUG
        p "end tag #{name}"
        p @tag_stack
      end
      text = @text_stack.pop
      tags = @tag_stack.pop
      pr = @proc_stack.pop
      pr.call(text, tags) unless pr.nil?
      @ns_stack.pop
    end

tag_start(name, attributes) click to toggle source

                   # File rss/parser.rb, line 297
    def tag_start(name, attributes)
      @text_stack.push('')

      ns = @ns_stack.last.dup
      attrs = {}
      attributes.each do |n, v|
        if /\Axmlns(?:\z|:)/ =~ n
          ns[$POSTMATCH] = v
        else
          attrs[n] = v
        end
      end
      @ns_stack.push(ns)

      prefix, local = split_name(name)
      @tag_stack.last.push([_ns(ns, prefix), local])
      @tag_stack.push([])
      if @xml_child_mode
        previous = @last_xml_element
        element_attrs = attributes.dup
        unless previous
          ns.each do |ns_prefix, value|
            next if ns_prefix == "xml"
            key = ns_prefix.empty? ? "xmlns" : "xmlns:#{ns_prefix}"
            element_attrs[key] ||= value
          end
        end
        next_element = XML::Element.new(local,
                                        prefix.empty? ? nil : prefix,
                                        _ns(ns, prefix),
                                        element_attrs)
        previous << next_element if previous
        @last_xml_element = next_element
        pr = Proc.new do |text, tags|
          if previous
            @last_xml_element = previous
          else
            @xml_element = @last_xml_element
            @last_xml_element = nil
          end
        end
        @proc_stack.push(pr)
      else
        if @rss.nil? and respond_to?("initial_start_#{local}", true)
          __send__("initial_start_#{local}", local, prefix, attrs, ns.dup)
        elsif respond_to?("start_#{local}", true)
          __send__("start_#{local}", local, prefix, attrs, ns.dup)
        else
          start_else_element(local, prefix, attrs, ns.dup)
        end
      end
    end

text(data) click to toggle source

                   # File rss/parser.rb, line 362
    def text(data)
      if @xml_child_mode
        @last_xml_element << data if @last_xml_element
      else
        @text_stack.last << data
      end
    end

xmldecl(version, encoding, standalone) click to toggle source

set instance vars for version, encoding, standalone

                   # File rss/parser.rb, line 284
    def xmldecl(version, encoding, standalone)
      @version, @encoding, @standalone = version, encoding, standalone
    end