Class: Webkit

Inherits:
Browser show all
Defined in:
lib/hanoi/browsers/webkit.rb

Direct Known Subclasses

Safari

Instance Method Summary collapse

Methods inherited from Browser

#escaped_name, #host, #linux?, #macos?, #name, #open, #path, #to_s, #windows?

Instance Method Details

#setupObject



6
7
8
# File 'lib/hanoi/browsers/webkit.rb', line 6

def setup
  applescript(%(tell application "#{name}" to make new document)) if macos?
end

#supported?Boolean

Returns:

  • (Boolean)


2
3
4
# File 'lib/hanoi/browsers/webkit.rb', line 2

def supported?
  macos? || windows?
end

#teardownObject



18
19
20
# File 'lib/hanoi/browsers/webkit.rb', line 18

def teardown
  #applescript('tell application "Safari" to close front document')
end

#visit(url) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/hanoi/browsers/webkit.rb', line 10

def visit(url)
  if macos?
    applescript(%(tell application "#{name}" to set URL of front document to "#{url}"))
  elsif windows?
    system("#{path} #{url}")
  end
end