I don’t know which version of Ruby you are using, possibly 1.8.7, on Ruby 1.9 and 2.1.0 the error reported for the code is get '/' { 501 }:
syntax error, unexpected '{', expecting $end
, { 501 } '/', get('\' { 501 }), , , . , '\':
get('/') { 501 }