Commit 924a8eb

mo <mo@mokhan.ca>
2018-05-09 23:45:12
save the attributes not the class.
1 parent a4ca7e9
Changed files (2)
lib/del/connection.rb
@@ -19,7 +19,7 @@ module Del
       client.auth(configuration.password)
       roster = Jabber::Roster::Helper.new(client, false)
       roster.add_update_callback do |old_item, item|
-        users.upsert(item['jid'], User.new(item['jid'], item)) if item
+        users.upsert(item['jid'], item.attributes) if item
       end
       roster.get_roster
       roster.wait_for_roster
lib/del/repository.rb
@@ -10,11 +10,7 @@ module Del
     end
 
     def find_by(id)
-      @lock.synchronize { @storage[id.to_s] }
-    end
-
-    def find_by_value
-      @lock.synchronize { @storage.values.find { |x| yield x } }
+      @lock.synchronize { Del::User.new(id, @storage[id.to_s]) }
     end
 
     def find_all