Module: Rubigraph

Defined in:
lib/rubigraph.rb

Overview

Ruby wrapper for Ubigraph.

Call Rubigraph.init at first.

Defined Under Namespace

Classes: Edge, Vertex

Constant Summary collapse

VERSION =
'0.2.0'

Class Method Summary collapse

Class Method Details

.call(msg, *args) ⇒ Object



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/rubigraph.rb', line 173

def self.call(msg, *args)
  @mutex.synchronize {
    case args.size
    when 0
      @server.call(msg)
    when 1
      @server.call(msg, args[0])
    when 2
      @server.call(msg, args[0], args[1])
    when 3
      @server.call(msg, args[0], args[1], args[2])
    else
      raise
    end
  }
end

.clearObject

clear all vertex, edges



169
170
171
# File 'lib/rubigraph.rb', line 169

def self.clear
  call('ubigraph.clear')
end

.init(host = '127.0.0.1', port = '20738') ⇒ Object

initialize XML-RPC client



163
164
165
166
# File 'lib/rubigraph.rb', line 163

def self.init(host='127.0.0.1', port='20738')
  @server = XMLRPC::Client.new2("http://#{host}:#{port}/RPC2")
  @mutex  = Mutex.new
end