Class | RSS::Element
In: | rss/rss.rb
Parent: | Object

### Methods

convert converter= full_name get_attributes have_children_elements indent_size indent_size inherited install_ns model must_call_validators need_initialize_variables new plural_forms required_prefix required_uri setup_maker tag_name tag_name validate validate_for_stream

### Included Modules

Utils

### Constants

INDENT | = | " "
MUST_CALL_VALIDATORS | = | {}
MODEL | = | []
GET_ATTRIBUTES | = | []
HAVE_CHILDREN_ELEMENTS | = | []
NEED_INITIALIZE_VARIABLES | = | []
PLURAL_FORMS | = | {}

### Attributes

do_validate | [RW] |

### Public Class methods

get_attributes()

[Source]

    # File rss/rss.rb, line 387
          def get_attributes
            GET_ATTRIBUTES
          end

have_children_elements()

[Source]

    # File rss/rss.rb, line 390
          def have_children_elements
            HAVE_CHILDREN_ELEMENTS
          end

indent_size()

[Source]

    # File rss/rss.rb, line 501
          def indent_size
            @indent_size
          end

inherited(klass)

[Source]

    # File rss/rss.rb, line 401
          def inherited(klass)
            klass.const_set("MUST_CALL_VALIDATORS", {})
            klass.const_set("MODEL", [])
            klass.const_set("GET_ATTRIBUTES", [])
            klass.const_set("HAVE_CHILDREN_ELEMENTS", [])
            klass.const_set("NEED_INITIALIZE_VARIABLES", [])
            klass.const_set("PLURAL_FORMS", {})

            klass.module_eval("public\n\n@tag_name = name.split(/::/).last\n@tag_name[0,1] = @tag_name[0,1].downcase\n@indent_size = name.split(/::/).size - 2\n@have_content = false\n\ndef self.must_call_validators\nsuper.merge(MUST_CALL_VALIDATORS)\nend\ndef self.model\nMODEL + super\nend\ndef self.get_attributes\nGET_ATTRIBUTES + super\nend\ndef self.have_children_elements\nHAVE_CHILDREN_ELEMENTS + super\nend\ndef self.need_initialize_variables\nNEED_INITIALIZE_VARIABLES + super\nend\ndef self.plural_forms\nsuper.merge(PLURAL_FORMS)\nend\n\n\ndef self.install_must_call_validator(prefix, uri)\nMUST_CALL_VALIDATORS[uri] = prefix\nend\n\ndef self.install_model(tag, occurs=nil)\nif m = MODEL.find {|t, o| t == tag}\nm[1] = occurs\nelse\nMODEL << [tag, occurs]\nend\nend\n\ndef self.install_get_attribute(name, uri, required=true)\nattr_writer name\nconvert_attr_reader name\nGET_ATTRIBUTES << [name, uri, required]\nend\n\ndef self.content_setup\nattr_writer :content\nconvert_attr_reader :content\ndef_content_only_to_s\n@have_content = true\nend\n\ndef self.have_content?\n@have_content\nend\n\ndef self.add_have_children_element(variable_name, plural_name)\nHAVE_CHILDREN_ELEMENTS << [variable_name, plural_name]\nend\n\ndef self.add_need_initialize_variable(variable_name)\nNEED_INITIALIZE_VARIABLES << variable_name\nend\n\ndef self.add_plural_form(singular, plural)\nPLURAL_FORMS[singular] = plural\nend\n\n")
          end

install_ns(prefix, uri)

[Source]

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

model()

[Source]

    # File rss/rss.rb, line 384
          def model
            MODEL
          end

must_call_validators()

[Source]

    # File rss/rss.rb, line 381
          def must_call_validators
            MUST_CALL_VALIDATORS
          end

need_initialize_variables()

[Source]

    # File rss/rss.rb, line 393
          def need_initialize_variables
            NEED_INITIALIZE_VARIABLES
          end

new(do_validate=true)

[Source]

    # File rss/rss.rb, line 509
        def initialize(do_validate=true)
          @converter = nil
          @do_validate = do_validate
          initialize_variables
        end

plural_forms()

[Source]

    # File rss/rss.rb, line 396
          def plural_forms
            PLURAL_FORMS
          end

required_prefix()

[Source]

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

required_uri()

[Source]

    # File rss/rss.rb, line 486
          def required_uri
            nil
          end

tag_name()

[Source]

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

### Public Instance methods

convert(value)

[Source]

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

converter=(converter)

[Source]

    # File rss/rss.rb, line 527
        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()

[Source]

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

indent_size()

[Source]

    # File rss/rss.rb, line 523
        def indent_size
          self.class.indent_size
        end

setup_maker(maker)

[Source]

    # File rss/rss.rb, line 556
        def setup_maker(maker)
          target = maker_target(maker)
          unless target.nil?
            setup_maker_attributes(target)
            setup_maker_element(target)
            setup_maker_elements(target)
          end
        end

tag_name()

[Source]

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

validate()

[Source]

    # File rss/rss.rb, line 546
        def validate
          validate_attribute
          __validate
        end

validate_for_stream(tags)

[Source]

    # File rss/rss.rb, line 551
        def validate_for_stream(tags)
          validate_attribute
          __validate(tags, false)
        end

[Validate]