what do the different brackets in ruby mean

In Ruby, what's the difference between {} and []?{} seems to be used for both code blocks and hashes. Are [] only for arrays?

Broadly speaking, you're correct. As well as hashes, the general style is that curly braces {} are often used for blocks that can fit all onto one line, instead of using do/end across several lines.

Square brackets [] are used as class methods in lots of Ruby classes, including String, BigNum, Dir and confusingly enough, Hash. So:

Hash["key" => "value"]

is just as valid as:

{ "key" => "value" }