Sha256: 877bc49c8cf45a3900e0d8f929779c8eb5cd0aed18d9ee840ff9742cad5a2b2f

Contents?: true

Size: 600 Bytes

Versions: 3

Compression:

Stored size: 600 Bytes

Contents

module Irrc
  module Connecting
    private

    def connection
      @connection
    end

    def connection=(connection)
      @connection = connection
    end

    def connect
      @connection ||= logger.info("Connecting to #{@fqdn}") &&
        Net::Telnet.new('Host' => @fqdn,
        'Port' => 43,
        'Telnetmode' => false,
        'Prompt' => return_code)
    end

    def close
      if established?
        logger.info "Closing a connection to #{@fqdn}"
        @connection.close
      end
    end

    def established?
      @connection && !@connection.sock.closed?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
irrc-0.2.2 lib/irrc/connecting.rb
irrc-0.2.1 lib/irrc/connecting.rb
irrc-0.2.0 lib/irrc/connecting.rb