Class: Peplum::Application::Peers
- Inherits:
-
Object
- Object
- Peplum::Application::Peers
- Includes:
- Enumerable
- Defined in:
- lib/peplum/application/peers.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize ⇒ Peers
constructor
A new instance of Peers.
- #self_url ⇒ Object
- #set(peer_info) ⇒ Object
Constructor Details
#initialize ⇒ Peers
Returns a new instance of Peers.
7 8 9 |
# File 'lib/peplum/application/peers.rb', line 7 def initialize @peers = {} end |
Instance Method Details
#each(&block) ⇒ Object
20 21 22 23 24 |
# File 'lib/peplum/application/peers.rb', line 20 def each( &block ) @peers.each do |_, client| block.call client end end |
#self_url ⇒ Object
26 27 28 |
# File 'lib/peplum/application/peers.rb', line 26 def self_url Cuboid::Options.rpc.url end |
#set(peer_info) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/peplum/application/peers.rb', line 11 def set( peer_info ) peer_info.each do |url, token| next if url == self.self_url @peers[url] = Peplum::Application.connect( url: url, token: token ) end nil end |