Getting current window size 12/08/2013
# Getting the window size 
size = browser.window.size

# Height and width can be checked with
p size.height
p size.width

In some cases it can be useful to check the size of the currently active window even though setting the size is a more common operation.

Closing a window 12/12/2012
# browser.window refers to a new window that was opened in the test
browser.window.close

# In case multiple new windows are opened, the following can be used
browser.windows.each do |w|
  w.close if w.title =~ /window to be closed/
end

# Alternatively, the map method can be used in the folowing way
browser.windows.map { |w| w.close if w.title =~ /window to be closed/ }

Closing a window, for example, after testing if a link opens a new window can be done as shown in this droplet.

Switching to a window 24/08/2012
# Using a specific window provided that the user already knows which window to select
browser.window.use

# If the user first needs to find a window, one way is to loop through windows and 
# compare a specific attribute. For example:
browser.windows.each do |w|
  w.use if w.title =~ /Google/
end

# The above could cause havoc in there are multiple windows with a similar title.
# Do be careful with the conditions.

WebDriver has methods to use a specific window in case multiple windows are open. The user will first have to find the one that he wants to use. Ways to do that include comparing the title or the URL to the expected one.