An Unordered and Incomplete List of Things You Should Probably Never Use/Do in Ruby
(thanks to Zach Drayer and Ben Stiglitz for their feedback)
- Don't use the implicit
$_
style parameters where any reasonably sane person might expect a parameter, like#puts
. - Don't use the string-manipulation methods included in Kernel, like
chomp
,chop
,sub
, andgsub
. Call them on String instances instead. If you use these methods in combination with$_
style parameters, you are why we can't have nice things. - Don't use
callcc
, because it's inefficient, leaks like a sieve, and isn't included in most implementations. - Don't call
Array#pack
orString#unpack
to store data. YAML/Marshal are more powerful and miles saner. - Don't use
Kernel#test
. Come on, this isn't Perl. Compare the fields of File.stat instead. - Don't use
Kernel#syscall
orIO#syscall
. You shouldn't even do this in C.