Sha256: 6828d8d5f128741ed1cf6e1ad73a680e76a023e91d22f24eed1cb5c8db3476c3
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
module SPNet # Output signal values to a connected SignalInPort object. # # @author James Tunnell class SignalOutPort < OutPort attr_reader :queue # A new instance of SignalOutPort. def initialize @queue = [] super(:matching_class => SignalInPort) end # Add values to queue or send them directly to linked port # (if autosend is true). # @param [Array] values The values to add. # @param [true/false] autosend If true, and this port is linked to another # port, skip this port's queue and enqueue values # directly on the linked port's queue. def enqueue_values values, autosend = true if autosend && linked? @link.to.enqueue_values values else @queue.concat values end end # Remove values to queue. # @param [Fixnum] count Number of values to remove. def dequeue_values count = @queue.count raise ArgumentError, "count is greater than @queue.count" if count > @queue.count @queue.slice!(0...count) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spnet-0.1.8 | lib/spnet/ports/signal_out_port.rb |
spnet-0.1.7 | lib/spnet/ports/signal_out_port.rb |