Class: OrientdbBinary::OrientdbBase

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

Direct Known Subclasses

Database, Server

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ OrientdbBase

Returns a new instance of OrientdbBase.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/orientdb_binary/base.rb', line 5

def initialize(options)
  defaults = {
    host: 'localhost',
    port: 2424
  }

  @options = defaults.merge(options)

  @server_connection = OrientdbBinary::Connection.new(@options)
  @socket = @server_connection.socket
  @connected = false
  @session = OrientdbBinary::OperationTypes::NEW_SESSION
end

Instance Attribute Details

#protocolObject

Returns the value of attribute protocol.



3
4
5
# File 'lib/orientdb_binary/base.rb', line 3

def protocol
  @protocol
end

#sessionObject

Returns the value of attribute session.



3
4
5
# File 'lib/orientdb_binary/base.rb', line 3

def session
  @session
end

#socketObject

Returns the value of attribute socket.



3
4
5
# File 'lib/orientdb_binary/base.rb', line 3

def socket
  @socket
end

Instance Method Details

#closeObject



28
29
30
31
# File 'lib/orientdb_binary/base.rb', line 28

def close
  @session = OrientdbBinary::OperationTypes::NEW_SESSION
  @connected = false
end

#connected?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/orientdb_binary/base.rb', line 19

def connected?
  @connected
end

#disconnectObject



23
24
25
26
# File 'lib/orientdb_binary/base.rb', line 23

def disconnect
  close
  @server_connection.close()
end