Class: OrientdbBinary::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/orientdb_binary/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Connection

Returns a new instance of Connection.



6
7
8
9
# File 'lib/orientdb_binary/connection.rb', line 6

def initialize(options)
  @socket = TCPSocket.open(options[:host], options[:port])
  @protocol = BinData::Int16be.read(socket)
end

Instance Attribute Details

#protocolObject

Returns the value of attribute protocol.



4
5
6
# File 'lib/orientdb_binary/connection.rb', line 4

def protocol
  @protocol
end

#socketObject

Returns the value of attribute socket.



4
5
6
# File 'lib/orientdb_binary/connection.rb', line 4

def socket
  @socket
end

Instance Method Details

#closeObject



11
12
13
14
# File 'lib/orientdb_binary/connection.rb', line 11

def close
  socket.close
  @protocol = nil
end