I wrote a simple EventMachine server like this one:
EventMachine.run do
EventMachine::WebSocket.start(:host => HOST, :port => PORT) do |ws|
# snip...
end
end
Now, I would like to trigger it from another file in another directory. If EventMachine would be a simple Ruby class I would add a run (or something) class method and do something like:
#!/usr/bin/env ruby
$LOAD_PATH << "./lib"
require "my_event_machine"
MyEventMachine.run
Any idea how to do this? Thanks!
You already had the solution:
my_app.rb:
run.rb: