class QLab::Machine
Attributes
address[RW]
name[RW]
port[RW]
Public Class Methods
new(_address, _port)
click to toggle source
Connect to a running QLab
instance. ‘address` can be a domain name or an IP Address.
# File lib/qlab-ruby/machine.rb, line 7 def initialize(_address, _port) self.name = _address self.address = _address self.port = _port connect end
Public Instance Methods
alwaysReply=(value)
click to toggle source
# File lib/qlab-ruby/machine.rb, line 75 def alwaysReply=(value) # send set command alwaysReply(value) end
close()
click to toggle source
# File lib/qlab-ruby/machine.rb, line 64 def close @connection.close @connection = nil end
connect()
click to toggle source
Open and return a connection to the running QLab
instance
# File lib/qlab-ruby/machine.rb, line 27 def connect if !connected? @connection = OSC::TCP::Client.new(@address, @port) else connection end end
connected?()
click to toggle source
# File lib/qlab-ruby/machine.rb, line 60 def connected? !(@connection.nil? || send_message('/version').nil?) end
connection()
click to toggle source
Reference to the running QLab
instance
# File lib/qlab-ruby/machine.rb, line 36 def connection @connection || connect end
find_workspace(params={})
click to toggle source
Find a workspace according to the given params.
# File lib/qlab-ruby/machine.rb, line 47 def find_workspace params={} workspaces.find do |ws| matches = true # match each key to the given workspace params.keys.each do |key| matches = matches && (ws.send(key.to_sym) == params[key]) end matches end end
refresh()
click to toggle source
# File lib/qlab-ruby/machine.rb, line 69 def refresh close connect load_workspaces end
workspaces()
click to toggle source
The workspaces provided by the connected QLab
instance
# File lib/qlab-ruby/machine.rb, line 41 def workspaces @workspaces || load_workspaces end
Private Instance Methods
load_workspaces()
click to toggle source
# File lib/qlab-ruby/machine.rb, line 82 def load_workspaces @workspaces = [] data = send_message('/workspaces') data.map do |ws| @workspaces << QLab::Workspace.new(ws, self) end @workspaces end