lib/xmpp4r/pubsub/children/items.rb in xmpp4r-0.4 vs lib/xmpp4r/pubsub/children/items.rb in xmpp4r-0.5
- old
+ new
@@ -8,10 +8,11 @@
module PubSub
##
# Items
# a collection of Items
class Items < XMPPElement
+ include Enumerable
name_xmlns 'items', NS_PUBSUB
def node
attributes['node']
end
@@ -20,16 +21,24 @@
end
def subid
attributes['subid']
end
def subid=(mysubid)
- attributes['subid'] = mysubid
+ attributes['subid'] = mysubid.to_s
end
def max_items
attributes['max_items']
end
def max_items=(mymaxitems)
- attributes['max_items'] = mymaxitems
+ attributes['max_items'] = mymaxitems.to_s
+ end
+
+ def items
+ get_elements("item")
+ end
+
+ def each(&block)
+ items.each(&block)
end
end
##
# Items wrapped in a Pubsub Event.