Class: OSC::Server
Instance Method Summary collapse
- #add_method(address_pattern, &proc) ⇒ Object
-
#initialize(port) ⇒ Server
constructor
A new instance of Server.
- #run ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(port) ⇒ Server
Returns a new instance of Server.
4 5 6 7 8 9 |
# File 'lib/osc-ruby/server.rb', line 4 def initialize(port) @socket = UDPSocket.new @socket.bind('', port) @cb = [] @queue = Queue.new end |
Instance Method Details
#add_method(address_pattern, &proc) ⇒ Object
21 22 23 24 25 |
# File 'lib/osc-ruby/server.rb', line 21 def add_method(address_pattern, &proc) matcher = AddressPattern.new( address_pattern ) @cb << [matcher, proc] end |
#run ⇒ Object
11 12 13 14 15 |
# File 'lib/osc-ruby/server.rb', line 11 def run start_dispatcher start_detector end |
#stop ⇒ Object
17 18 19 |
# File 'lib/osc-ruby/server.rb', line 17 def stop @socket.close end |