Sha256: 73f7f18bcae339e50243ba1a04d79a5a56fdda2a42b7ed4bca29c00003902fe2

Contents?: true

Size: 677 Bytes

Versions: 3

Compression:

Stored size: 677 Bytes

Contents

class EchoClient < Raktr::Connection

    attr_reader :initialization_args
    attr_reader :received_data

    attr_reader :error
    attr_reader :on_write_count
    attr_reader :called_on_flush

    def initialize( *args )
        @initialization_args = args
        @on_write_count      = 0
        @called_on_flush     = false
    end

    def on_write
        @on_write_count += 1
    end

    def on_flush
        @called_on_flush = !has_outgoing_data?
    end

    def on_close( error )
        @error = error
        @raktr.stop
    end

    def on_read( data )
        (@received_data ||= '') << data
        @raktr.stop if @received_data.end_with? "\n\n"
    end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
raktr-0.0.3 spec/support/fixtures/handlers/echo_client.rb
raktr-0.0.2 spec/support/fixtures/handlers/echo_client.rb
raktr-0.0.1 spec/support/fixtures/handlers/echo_client.rb