Sha256: e00bfbfc5224733211ba01733d5047080bacd0e680022e2d6294220782637c53
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
module P2 # Represents external Driver for P2 Router server app class Router ROUTER_TITLE = Regexp.new('P2MQRouter - ') include P2 def self.find router = ::WinGui::App.find :title => ROUTER_TITLE router ? new(:app => router) : nil end attr_reader :opts, :app def initialize opts = {} @opts = opts.dup if @opts[:app] @app = @opts[:app] else @opts[:ini] = Pathname(@opts[:ini] || @opts[:ini_file] || "./client_router.ini") error "Wrong ini file name" unless @opts[:ini].expand_path.exist? || @opts[:args] @opts[:title] ||= ROUTER_TITLE @opts[:path] ||= @opts[:dir] && @opts[:dir] + 'P2MQRouter.exe' @opts[:args] ||= "/ini:#{@opts[:ini]}" @opts[:timeout] ||= 3 @app = ::WinGui::App.launch(:dir => @opts[:dir], :path => @opts[:path], :args => @opts[:args], :title => @opts[:title], :timeout => @opts[:timeout]) end end def method_missing *args @app.send *args end def title @app.main_window.title end end # class Router end # module P2
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
p2ruby-0.1.5 | lib/p2ruby/router.rb |
p2ruby-0.1.4 | lib/p2ruby/router.rb |
p2ruby-0.1.2 | lib/p2ruby/router.rb |