lib/atom/element.rb in atom-tools-0.9.2 vs lib/atom/element.rb in atom-tools-0.9.3

- old
+ new

@@ -30,28 +30,33 @@ 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 + # The Class' methods provide a DSL for describing Atom's structure + # (and more generally for describing simple namespaced XML) class Element < Hash # a REXML::Element that shares this element's extension attributes # and child elements attr_reader :extensions # this element's xml:base attr_accessor :base - - # The following is a DSL for describing an atom element. # this element's attributes def self.attrs # :nodoc: @attrs || [] end