Class: RSS::Element (Ruby 2.4.2)
Description: Class : RSS::Element - Ruby 2.4.2

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

### Home Classes Methods

### In Files

- rss/rss.rb

### Parent

Object

### Methods

- ::add_have_children_element
- ::add_need_initialize_variable
- ::add_plural_form
- ::add_to_element_method
- ::content_setup
- ::def_corresponded_attr_reader
- ::def_corresponded_attr_writer
- ::get_attributes
- ::have_children_elements
- ::have_content?
- ::inherited
- ::inherited_base
- ::install_get_attribute
- ::install_model
- ::install_must_call_validator
- ::install_ns
- ::models
- ::must_call_validators
- ::need_initialize_variables
- ::need_parent?
- ::new
- ::plural_forms
- ::required_prefix
- ::required_uri
- ::tag_name
- ::to_element_methods
- #convert
- #converter=
- #full_name
- #have_required_elements?
- #have_xml_content?
- #need_base64_encode?
- #set_next_element
- #tag_name
- #to_s
- #valid?
- #validate
- #validate_for_stream

### Included Modules

- RSS::Utils
- RSS::SetupMaker

### 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::Element

### Constants

GET_ATTRIBUTES
HAVE_CHILDREN_ELEMENTS
INDENT
MODELS
MUST_CALL_VALIDATORS
NEED_INITIALIZE_VARIABLES
PLURAL_FORMS
TO_ELEMENT_METHODS

### Attributes

do_validate[RW]
parent[RW]

### Public Class Methods

add_have_children_element(variable_name, plural_name) click to toggle source

                   # File rss/rss.rb, line 809
    def add_have_children_element(variable_name, plural_name)
      self::HAVE_CHILDREN_ELEMENTS << [variable_name, plural_name]
    end

add_need_initialize_variable(variable_name) click to toggle source

                   # File rss/rss.rb, line 817
    def add_need_initialize_variable(variable_name)
      self::NEED_INITIALIZE_VARIABLES << variable_name
    end

add_plural_form(singular, plural) click to toggle source

                   # File rss/rss.rb, line 821
    def add_plural_form(singular, plural)
      self::PLURAL_FORMS[singular] = plural
    end

add_to_element_method(method_name) click to toggle source

                   # File rss/rss.rb, line 813
    def add_to_element_method(method_name)
      self::TO_ELEMENT_METHODS << method_name
    end

content_setup(type=nil, disp_name=nil) click to toggle source

                   # File rss/rss.rb, line 798
    def content_setup(type=nil, disp_name=nil)
      writer_type, reader_type = type
      def_corresponded_attr_writer :content, writer_type, disp_name
      def_corresponded_attr_reader :content, reader_type
      @have_content = true
    end

def_corresponded_attr_reader(name, type=nil) click to toggle source

                   # File rss/rss.rb, line 779
    def def_corresponded_attr_reader(name, type=nil)
      case type
      when :inherit
        inherit_convert_attr_reader name
      when :uri
        uri_convert_attr_reader name
      when :yes_clean_other
        yes_clean_other_attr_reader name
      when :yes_other
        yes_other_attr_reader name
      when :csv
        csv_attr_reader name
      when :csv_integer
        csv_attr_reader name, :separator => ","
      else
        convert_attr_reader name
      end
    end

def_corresponded_attr_writer(name, type=nil, disp_name=nil) click to toggle source

                   # File rss/rss.rb, line 751
    def def_corresponded_attr_writer(name, type=nil, disp_name=nil)
      disp_name ||= name
      case type
      when :integer
        integer_writer name, disp_name
      when :positive_integer
        positive_integer_writer name, disp_name
      when :boolean
        boolean_writer name, disp_name
      when :w3cdtf, :rfc822, :rfc2822
        date_writer name, type, disp_name
      when :text_type
        text_type_writer name, disp_name
      when :content
        content_writer name, disp_name
      when :yes_clean_other
        yes_clean_other_writer name, disp_name
      when :yes_other
        yes_other_writer name, disp_name
      when :csv
        csv_writer name
      when :csv_integer
        csv_integer_writer name
      else
        attr_writer name
      end
    end

get_attributes() click to toggle source

                   # File rss/rss.rb, line 688
    def get_attributes
      inherited_array_reader("GET_ATTRIBUTES")
    end

have_children_elements() click to toggle source

                   # File rss/rss.rb, line 691
    def have_children_elements
      inherited_array_reader("HAVE_CHILDREN_ELEMENTS")
    end

have_content?() click to toggle source

                   # File rss/rss.rb, line 805
    def have_content?
      @have_content
    end

inherited(klass) click to toggle source

                   # File rss/rss.rb, line 708
    def inherited(klass)
      klass.const_set(:MUST_CALL_VALIDATORS, {})
      klass.const_set(:MODELS, [])
      klass.const_set(:GET_ATTRIBUTES, [])
      klass.const_set(:HAVE_CHILDREN_ELEMENTS, [])
      klass.const_set(:TO_ELEMENT_METHODS, [])
      klass.const_set(:NEED_INITIALIZE_VARIABLES, [])
      klass.const_set(:PLURAL_FORMS, {})

      tag_name = klass.name.split(/::/).last
      tag_name[0, 1] = tag_name[0, 1].downcase
      klass.instance_variable_set(:@tag_name, tag_name)
      klass.instance_variable_set(:@have_content, false)
    end

inherited_base() click to toggle source

                   # File rss/rss.rb, line 704
    def inherited_base
      ::RSS::Element
    end

install_get_attribute(name, uri, required=true, type=nil, disp_name=nil, element_name=nil) click to toggle source

                   # File rss/rss.rb, line 736
    def install_get_attribute(name, uri, required=true,
                              type=nil, disp_name=nil,
                              element_name=nil)
      disp_name ||= name
      element_name ||= name
      writer_type, reader_type = type
      def_corresponded_attr_writer name, writer_type, disp_name
      def_corresponded_attr_reader name, reader_type
      if type == :boolean and /^is/ =~ name
        alias_method "#{$POSTMATCH}?", name
      end
      self::GET_ATTRIBUTES << [name, uri, required, element_name]
      add_need_initialize_variable(disp_name)
    end

install_model(tag, uri, occurs=nil, getter=nil, plural=false) click to toggle source

                   # File rss/rss.rb, line 727
    def install_model(tag, uri, occurs=nil, getter=nil, plural=false)
      getter ||= tag
      if m = self::MODELS.find {|t, u, o, g, p| t == tag and u == uri}
        m[2] = occurs
      else
        self::MODELS << [tag, uri, occurs, getter, plural]
      end
    end

install_must_call_validator(prefix, uri) click to toggle source

                   # File rss/rss.rb, line 723
    def install_must_call_validator(prefix, uri)
      self::MUST_CALL_VALIDATORS[uri] = prefix
    end

install_ns(prefix, uri) click to toggle source

                   # File rss/rss.rb, line 837
    def install_ns(prefix, uri)
      if self::NSPOOL.has_key?(prefix)
        raise OverlappedPrefixError.new(prefix)
      end
      self::NSPOOL[prefix] = uri
    end

models() click to toggle source

                   # File rss/rss.rb, line 685
    def models
      inherited_array_reader("MODELS")
    end

must_call_validators() click to toggle source

                   # File rss/rss.rb, line 682
    def must_call_validators
      inherited_hash_reader("MUST_CALL_VALIDATORS")
    end

need_initialize_variables() click to toggle source

                   # File rss/rss.rb, line 697
    def need_initialize_variables
      inherited_array_reader("NEED_INITIALIZE_VARIABLES")
    end

need_parent?() click to toggle source

                   # File rss/rss.rb, line 833
    def need_parent?
      false
    end

new(do_validate=true, attrs=nil) click to toggle source

                   # File rss/rss.rb, line 851
    def initialize(do_validate=true, attrs=nil)
      @parent = nil
      @converter = nil
      if attrs.nil? and (do_validate.is_a?(Hash) or do_validate.is_a?(Array))
        do_validate, attrs = true, do_validate
      end
      @do_validate = do_validate
      initialize_variables(attrs || {})
    end

plural_forms() click to toggle source

                   # File rss/rss.rb, line 700
    def plural_forms
      inherited_hash_reader("PLURAL_FORMS")
    end

required_prefix() click to toggle source

                   # File rss/rss.rb, line 825
    def required_prefix
      nil
    end

required_uri() click to toggle source

                   # File rss/rss.rb, line 829
    def required_uri
      ""
    end

tag_name() click to toggle source

                   # File rss/rss.rb, line 844
    def tag_name
      @tag_name
    end

to_element_methods() click to toggle source

                   # File rss/rss.rb, line 694
    def to_element_methods
      inherited_array_reader("TO_ELEMENT_METHODS")
    end

### Public Instance Methods

convert(value) click to toggle source

                   # File rss/rss.rb, line 880
    def convert(value)
      if @converter
        @converter.convert(value)
      else
        value
      end
    end

converter=(converter) click to toggle source

                   # File rss/rss.rb, line 869
    def converter=(converter)
      @converter = converter
      targets = children.dup
      self.class.have_children_elements.each do |variable_name, plural_name|
        targets.concat(__send__(plural_name))
      end
      targets.each do |target|
        target.converter = converter unless target.nil?
      end
    end

full_name() click to toggle source

                   # File rss/rss.rb, line 865
    def full_name
      tag_name
    end

have_xml_content?() click to toggle source

                   # File rss/rss.rb, line 930
    def have_xml_content?
      false
    end

need_base64_encode?() click to toggle source

                   # File rss/rss.rb, line 934
    def need_base64_encode?
      false
    end

set_next_element(tag_name, next_element) click to toggle source

                   # File rss/rss.rb, line 938
    def set_next_element(tag_name, next_element)
      klass = next_element.class
      prefix = ""
      prefix << "#{klass.required_prefix}_" if klass.required_prefix
      key = "#{prefix}#{tag_name.gsub(/-/, '_')}"
      if self.class.plural_forms.has_key?(key)
        ary = __send__("#{self.class.plural_forms[key]}")
        ary << next_element
      else
        __send__("#{key}=", next_element)
      end
    end

tag_name() click to toggle source

                   # File rss/rss.rb, line 861
    def tag_name
      self.class.tag_name
    end

to_s(need_convert=true, indent='') click to toggle source

                   # File rss/rss.rb, line 909
    def to_s(need_convert=true, indent='')
      if self.class.have_content?
        return "" if !empty_content? and !content_is_set?
        rv = tag(indent) do |next_indent|
          if empty_content?
            ""
          else
            xmled_content
          end
        end
      else
        rv = tag(indent) do |next_indent|
          self.class.to_element_methods.collect do |method_name|
            __send__(method_name, false, next_indent)
          end
        end
      end
      rv = convert(rv) if need_convert
      rv
    end

valid?(ignore_unknown_element=true) click to toggle source

                   # File rss/rss.rb, line 888
    def valid?(ignore_unknown_element=true)
      validate(ignore_unknown_element)
      true
    rescue RSS::Error
      false
    end

validate(ignore_unknown_element=true) click to toggle source

                   # File rss/rss.rb, line 895
    def validate(ignore_unknown_element=true)
      do_validate = @do_validate
      @do_validate = true
      validate_attribute
      __validate(ignore_unknown_element)
    ensure
      @do_validate = do_validate
    end

validate_for_stream(tags, ignore_unknown_element=true) click to toggle source

                   # File rss/rss.rb, line 904
    def validate_for_stream(tags, ignore_unknown_element=true)
      validate_attribute
      __validate(ignore_unknown_element, tags, false)
    end

### Protected Instance Methods

have_required_elements?() click to toggle source

                   # File rss/rss.rb, line 952
    def have_required_elements?
      self.class::MODELS.all? do |tag, uri, occurs, getter|
        if occurs.nil? or occurs == "+"
          child = __send__(getter)
          if child.is_a?(Array)
            children = child
            children.any? {|c| c.have_required_elements?}
          else
            not child.nil?
          end
        else
          true
        end
      end
    end