Module: Atom

Defined in:
lib/atom/element.rb,
lib/atom/feed.rb,
lib/atom/http.rb,
lib/atom/text.rb,
lib/atom/yaml.rb,
lib/atom/entry.rb,
lib/atom/service.rb,
lib/atom/collection.rb

Overview

:nodoc:

Defined Under Namespace

Modules: DigestAuth, HTTPResponse Classes: AttrEl, Author, Category, Collection, Content, Contributor, Element, Entry, Feed, FeedGone, HTTP, HTTPException, Link, Service, Text, Time, Unauthorized, Workspace, WrongMimetype, WrongNamespace, WrongResponse

Constant Summary collapse

UA =
"atom-tools 0.9.3"
NS =
"http://www.w3.org/2005/Atom"
PP_NS =
"http://purl.org/atom/app#"

Class Method Summary collapse

Class Method Details

.Multiple(klass) ⇒ Object

ignore the man behind the curtain.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/atom/element.rb', line 24

def self.Multiple klass
  Class.new(Array) do
    @class = klass

    def new
      item = self.class.holds.new
      self << item
    
      item
    end

    def << item
      raise ArgumentError, "this can only hold items of class #{self.class.holds}" unless item.is_a? self.class.holds
      super(item)
    end

    def to_element
      collect do |item| item.to_element end
    end

    def self.holds; @class end
    def self.single?; true end
    def taguri; end
  end
end