Class: Rubyfu::Book

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyfu.rb

Instance Method Summary collapse

Constructor Details

#initialize(config = {:port => 9911, :agent => :firefox}) ⇒ Book

rand(65000 - 1024) + 1024



14
15
16
17
18
19
# File 'lib/rubyfu.rb', line 14

def initialize(config = {:port => 9911, :agent => :firefox})
  @port  = config[:port]
  @agent = config[:agent]
  @webserver = WebServer.new(@port)
  @browser   = Browse.new(@agent, @port)
end

Instance Method Details

#runObject

A non-rubyfu way handle any webrick & watir processes TODO: Make webrick close when the browser closes



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rubyfu.rb', line 22

def run
  fork do
    begin 
      @browser.run 
    rescue
      # Do nothin ;)
    end
  end
  Process.wait
  Process.detach fork { @webserver.runit }
end