I don't know what this equates to in Ruby, as I've not come across nested arguments before:
open(filename [, mode [, perm]] [, opt]) → file
It's a shorthand way of describing many variants of the same function.
The square brackets indicate that that portion is optional. So in this instance it means you can use:
open(filename) open(filename, mode) open(filename, mode, perm) open(filename, mode, opt) open(filename, opt)
Perm is within two square brackets which means it's optional if
mode is used but can't be used without