Skip to content

Commit

Permalink
Merge branch 'enhancements'
Browse files Browse the repository at this point in the history
  • Loading branch information
mojodna committed Dec 1, 2008
2 parents f9b6735 + 781b98d commit 86f9209
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/xmpp4r/pubsub/children/items.rb
Expand Up @@ -10,6 +10,7 @@ module PubSub
# Items
# a collection of Items
class Items < XMPPElement
include Enumerable
name_xmlns 'items', NS_PUBSUB

def node
Expand All @@ -30,6 +31,14 @@ def max_items
def max_items=(mymaxitems)
attributes['max_items'] = mymaxitems
end

def items
get_elements("item")
end

def each(&block)
items.each(&block)
end
end

##
Expand Down
14 changes: 14 additions & 0 deletions lib/xmpp4r/pubsub/children/publish.rb
Expand Up @@ -13,7 +13,21 @@ module PubSub
# A <publish> XMPP element, see example 1 in
# http://www.xmpp.org/extensions/xep-0060.html#intro-howitworks
class Publish < XMPPElement
include Enumerable
name_xmlns 'publish', NS_PUBSUB

##
# support for enumerating <item> elements
def each(&block)
items.each(&block)
end

##
# return child <item> elements
def items
get_elements("item")
end

##
# return the node for this publication
def node
Expand Down

0 comments on commit 86f9209

Please sign in to comment.