Sha256: 6bd8cb0b50d0be0099667066d47ae92ae35966b402871bb65bbd3248df2c2be0

Contents?: true

Size: 522 Bytes

Versions: 15

Compression:

Stored size: 522 Bytes

Contents

class ProconBypassMan::Procon::PerformanceMeasurement::SpanTransferBuffer
  include Singleton

  def initialize
    @buff = []
  end

  # @param [Span]
  # @return [void]
  def push_and_run_block_if_buffer_over(value, &block)
    push(value)
    return unless buffer_over?

    block.call(spans)
    clear
  end

  private

  def spans
    @buff
  end

  def clear
    @buff.clear
  end

  def push(value)
    @buff << value
  end

  def buffer_over?
    @buff.length > max_buffer
  end

  def max_buffer
    50
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
procon_bypass_man-0.3.12 lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb
procon_bypass_man-0.3.11 lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb
procon_bypass_man-0.3.10 lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb
procon_bypass_man-0.3.9 lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb
procon_bypass_man-0.3.8.1 lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb
procon_bypass_man-0.3.8 lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb
procon_bypass_man-0.3.7 lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb
procon_bypass_man-0.3.6 lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb
procon_bypass_man-0.3.5 lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb
procon_bypass_man-0.3.4 lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb
procon_bypass_man-0.3.3.1 lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb
procon_bypass_man-0.3.3 lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb
procon_bypass_man-0.3.2 lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb
procon_bypass_man-0.3.1 lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb
procon_bypass_man-0.3.0 lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb