class Amberletters::BytesTrigger

Attributes

num_bytes[R]

Public Class Methods

new(num_bytes, options={}, &block) click to toggle source
Calls superclass method Amberletters::Trigger::new
# File lib/amberletters.rb, line 136
def initialize(num_bytes, options={}, &block)
  super(options, &block)
  @num_bytes = num_bytes
end

Public Instance Methods

call(process) click to toggle source
# File lib/amberletters.rb, line 145
def call(process)
  @logger.debug "checking if #{num_bytes} byes have been received"
  if process.rest_size >= num_bytes
    @block.call(self, process)
    true
  else
    false
  end
end
to_s() click to toggle source
# File lib/amberletters.rb, line 141
def to_s
  "#{num_bytes} bytes of output"
end