Sha256: eaf5c53723c22cb2dc26d98c779956ab74789cd36d5cdd2d7881dfa0c6180f7d
Contents?: true
Size: 623 Bytes
Versions: 2
Compression:
Stored size: 623 Bytes
Contents
module Buschtelefon class Tattler attr_reader :connections def initialize @connections = [] @brain = Brain.new end def knowledge @brain.to_a end def connect(tattler) @connections << tattler unless @connections.include?(tattler) end def feed(gossip) old_gossip = @brain.contains?(gossip) @brain << gossip # refresh memory return if old_gossip @connections.each { |tattler| tattler.feed(gossip) } end def transfer_knowledge(tattler) connect(tattler) knowledge.each { |gossip| tattler.feed(gossip) } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
buschtelefon-0.3.0 | lib/buschtelefon/tattler.rb |
buschtelefon-0.2.0 | lib/buschtelefon/tattler.rb |