Sha256: 4d3860a8b879e400327ac2d8f8a3bb2e9237c343ca9e668ba30d2454f1f14904

Contents?: true

Size: 1.22 KB

Versions: 11

Compression:

Stored size: 1.22 KB

Contents

require 'rss/1.0'

module RSS
  SLASH_PREFIX = 'slash'
  SLASH_URI = "http://purl.org/rss/1.0/modules/slash/"

  RDF.install_ns(SLASH_PREFIX, SLASH_URI)

  module SlashModel
    extend BaseModel

    ELEMENT_INFOS = \
    [
     ["section"],
     ["department"],
     ["comments", :positive_integer],
     ["hit_parade", :csv_integer],
    ]

    class << self
      def append_features(klass)
        super

        return if klass.instance_of?(Module)
        klass.install_must_call_validator(SLASH_PREFIX, SLASH_URI)
        ELEMENT_INFOS.each do |name, type, *additional_infos|
          full_name = "#{SLASH_PREFIX}_#{name}"
          klass.install_text_element(full_name, SLASH_URI, "?",
                                     full_name, type, name)
        end

        klass.module_eval do
          alias_method(:slash_hit_parades, :slash_hit_parade)
          undef_method(:slash_hit_parade)
          alias_method(:slash_hit_parade, :slash_hit_parade_content)
        end
      end
    end
  end

  class RDF
    class Item; include SlashModel; end
  end

  SlashModel::ELEMENT_INFOS.each do |name, type|
    accessor_base = "#{SLASH_PREFIX}_#{name}"
    BaseListener.install_get_text_element(SLASH_URI, name, accessor_base)
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
rubysl-rss-1.0.0 lib/rss/slash.rb
rubysl-rss-2.0.0 lib/rss/slash.rb
ruby_on_ruby-0.0.1 vendor/javascripts/emscripted-ruby/lib/rss/slash.rb
shoesgem-0.1514.0 shoes/ruby/lib/rss/slash.rb
shoesgem-0.1480.0 shoes/ruby/lib/rss/slash.rb
shoesgem-0.1469.0 shoes/ruby/lib/rss/slash.rb
shoesgem-0.1430.0 shoes/ruby/lib/rss/slash.rb
shoesgem-0.1429.0 shoes/ruby/lib/rss/slash.rb
shoesgem-0.1428.0 shoes/ruby/lib/rss/slash.rb
shoesgem-0.1426.0 shoes/ruby/lib/rss/slash.rb
shoesgem-0.1424.0 shoes/ruby/lib/rss/slash.rb