Module: RSS::BaseTrackBackModel

Module | RSS::BaseTrackBackModel
In: | rss/trackback.rb

### Methods

append_features

### Included Modules

TrackBackUtils

### Public Instance methods

append_features(klass)

[Source]

    # File rss/trackback.rb, line 37
        def append_features(klass)
          super

          unless klass.class == Module
            klass.module_eval {include TrackBackUtils}

            %w(ping).each do |name|
              var_name = "#{TRACKBACK_PREFIX}_#{name}"
              klass_name = name.capitalize
              klass.install_have_child_element(var_name)
              klass.module_eval("remove_method :\#{var_name}\ndef \#{var_name}\n@\#{var_name} and @\#{var_name}.value\nend\n\nremove_method :\#{var_name}=\ndef \#{var_name}=(value)\n@\#{var_name} = Utils.new_with_value_if_need(\#{klass_name}, value)\nend\n", __FILE__, __LINE__)
            end

            [%w(about s)].each do |name, postfix|
              var_name = "#{TRACKBACK_PREFIX}_#{name}"
              klass_name = name.capitalize
              klass.install_have_children_element(var_name)
              klass.module_eval("remove_method :\#{var_name}\ndef \#{var_name}(*args)\nif args.empty?\n@\#{var_name}.first and @\#{var_name}.first.value\nelse\nret = @\#{var_name}.send(\"[]\", *args)\nif ret.is_a?(Array)\nret.collect {|x| x.value}\nelse\nret.value\nend\nend\nend\n\nremove_method :\#{var_name}=\nremove_method :set_\#{var_name}\ndef \#{var_name}=(*args)\nif args.size == 1\nitem = Utils.new_with_value_if_need(\#{klass_name}, args[0])\n@\#{var_name}.push(item)\nelse\nnew_val = args.last\nif new_val.is_a?(Array)\nnew_val = new_value.collect do |val|\nUtils.new_with_value_if_need(\#{klass_name}, val)\nend\nelse\nnew_val = Utils.new_with_value_if_need(\#{klass_name}, new_val)\nend\n@\#{var_name}.send(\"[]=\", *(args[0..-2] + [new_val]))\nend\nend\nalias set_\#{var_name} \#{var_name}=\n", __FILE__, __LINE__)
            end
          end
        end

[Validate]