Class: Horseman::Browser::Window

Inherits:
Object
  • Object
show all
Defined in:
lib/horseman/browser/window.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(browser, output = nil) ⇒ Window

Returns a new instance of Window.



10
11
12
13
14
15
16
17
18
# File 'lib/horseman/browser/window.rb', line 10

def initialize(browser, output=nil)
	output ||= Output.new

	@browser = browser
	@output = output
	
	@document = @browser.last_action.response.document
	@location = Location.new(self)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *arguments, &block) ⇒ Object



35
36
37
# File 'lib/horseman/browser/window.rb', line 35

def method_missing(method, *arguments, &block)
  puts "Not implemented in Window: #{method} #{arguments.join(',')}"
end

Instance Attribute Details

#browserObject (readonly)

Returns the value of attribute browser.



7
8
9
# File 'lib/horseman/browser/window.rb', line 7

def browser
  @browser
end

#documentObject (readonly)

Returns the value of attribute document.



8
9
10
# File 'lib/horseman/browser/window.rb', line 8

def document
  @document
end

#locationObject (readonly)

Returns the value of attribute location.



8
9
10
# File 'lib/horseman/browser/window.rb', line 8

def location
  @location
end

#outputObject (readonly)

Returns the value of attribute output.



7
8
9
# File 'lib/horseman/browser/window.rb', line 7

def output
  @output
end

Instance Method Details

#alert(message) ⇒ Object



20
21
22
# File 'lib/horseman/browser/window.rb', line 20

def alert(message)
	output.display message
end

#respond_to?(method_sym, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/horseman/browser/window.rb', line 31

def respond_to?(method_sym, include_private = false)
  true
end

#topObject



24
25
26
# File 'lib/horseman/browser/window.rb', line 24

def top
	self
end

#windowObject



27
28
29
# File 'lib/horseman/browser/window.rb', line 27

def window
	self
end