Sha256: 2e7c62a098cc293802a65f7cf4556dde733b7bb4977d74cc3f300b10ccc327be
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
module Blather class Stanza class PubSub class Affiliations < PubSub register :pubsub_affiliations, :pubsub_affiliations, self.ns include Enumerable def initialize(type = nil, host = nil) super affiliations end ## # Kill the affiliations node before running inherit def inherit(node) affiliations.remove! super end def affiliations aff = pubsub.find_first('//pubsub_ns:affiliations', :pubsub_ns => self.class.ns) (self.pubsub << (aff = XMPPNode.new('affiliations'))) unless aff aff end def [](affiliation) list[affiliation] end def each(&block) list.each &block end def size list.size end def list items = affiliations.find('//pubsub_ns:affiliation', :pubsub_ns => self.class.ns) items.inject({}) do |hash, item| hash[item.attributes[:affiliation].to_sym] ||= [] hash[item.attributes[:affiliation].to_sym] << item.attributes[:node] hash end end end #Affiliations end #PubSub end #Stanza end #Blather
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
blather-0.2.2 | lib/blather/stanza/pubsub/affiliations.rb |