lib/blather/roster_item.rb in sprsquish-blather-0.3.4 vs lib/blather/roster_item.rb in sprsquish-blather-0.4.0

- old
+ new

@@ -11,10 +11,15 @@ :statuses attr_accessor :name, :groups + def self.new(item) + return item if item.is_a?(self) + super + end + ## # item:: can be a JID, String (a@b) or a Stanza def initialize(item) @statuses = [] @groups = [] @@ -27,10 +32,10 @@ when XMPPNode self.jid = JID.new(item[:jid]).stripped self.name = item[:name] self.subscription = item[:subscription] self.ask = item[:ask] - item.groups.each { |g| self.groups << g } + item.groups.each { |g| @groups << g } end @groups = [nil] if @groups.empty? end \ No newline at end of file