Sha256: a44cd0ccddf3ee7f8c25a45fa618787cab5b0e9e317725cf3d58794f1e4adb25

Contents?: true

Size: 442 Bytes

Versions: 1

Compression:

Stored size: 442 Bytes

Contents

module Buschtelefon
  class Tattler
    attr_reader :connections

    def initialize
      @connections = []
      @brain = Brain.new
    end

    def connect(tattler)
      @connections << tattler
      @connections.uniq!
    end

    def feed(gossip)
      old_gossip = @brain.contains?(gossip)
      @brain << gossip # refresh memory
      return if old_gossip

      @connections.each { |tattler| tattler.feed(gossip) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
buschtelefon-0.1.0 lib/buschtelefon/tattler.rb