Class: OSC::Server
- Inherits:
-
Object
- Object
- OSC::Server
- Defined in:
- lib/osc-ruby/server.rb
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.
3 4 5 6 7 8 |
# File 'lib/osc-ruby/server.rb', line 3 def initialize(port) @socket = UDPSocket.new @socket.bind('', port) @matchers = [] @queue = Queue.new end |
Instance Method Details
#add_method(address_pattern, &proc) ⇒ Object
20 21 22 23 24 |
# File 'lib/osc-ruby/server.rb', line 20 def add_method(address_pattern, &proc) matcher = AddressPattern.new(address_pattern) @matchers << [matcher, proc] end |
#run ⇒ Object
10 11 12 13 14 |
# File 'lib/osc-ruby/server.rb', line 10 def run start_dispatcher start_detector end |
#stop ⇒ Object
16 17 18 |
# File 'lib/osc-ruby/server.rb', line 16 def stop @socket.close end |