Class: Watobo::Gui::BrowserPreview

Inherits:
Object
  • Object
show all
Defined in:
lib/watobo/gui/browser_preview.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(proxy) ⇒ BrowserPreview

Returns a new instance of BrowserPreview.



220
221
222
223
224
# File 'lib/watobo/gui/browser_preview.rb', line 220

def initialize(proxy)
  @proxy = proxy
  @browser = nil

end

Instance Attribute Details

#proxyObject

Returns the value of attribute proxy.



197
198
199
# File 'lib/watobo/gui/browser_preview.rb', line 197

def proxy
  @proxy
end

Instance Method Details

#show(request, response) ⇒ Object



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/watobo/gui/browser_preview.rb', line 198

def show(request, response)
  begin
    if watoboProxy? then
      hashid = @proxy.addPreview(response)
      url = request.url.to_s
      url += request.query != '' ? '&' : '?'
      url += "WATOBOPreview=#{hashid}"
      puts "PreviewURL: #{url}"
      @browser.navigate(url) if hashid
      return url
    else
      raise "WRONG_PROXY_SETTINGS"
    end
  rescue => bang
    puts bang
    #   puts bang.class
    #  puts bang.backtrace if $DEBUG
    raise bang
  end
  #raise "Wrong Proxy Settings"
end