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

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

# Alternatively, the map method can be used in the folowing way { |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

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

# 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.