Skip to content

Instantly share code, notes, and snippets.

@mbillard
Created May 4, 2015 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbillard/eeab2268b8e4bfd2ad3b to your computer and use it in GitHub Desktop.
Save mbillard/eeab2268b8e4bfd2ad3b to your computer and use it in GitHub Desktop.
WTF, Ruby (and Rails)?
- `0` is `true`
- Everything is an object, even `nil`
- `===`
- different behavior depending on classes, only use/define for `case...when` blocks
- private class methods (http://domon.cc/2013/12/25/private-class-methods-in-ruby/)
- `and` and `or` vs `&&` and `||`
- constants are not constants unless you freeze them
- `5 / 2 # => 2` transform your integers to floats before doing operations
More:
- http://stackoverflow.com/questions/372652/what-are-the-ruby-gotchas-a-newbie-should-be-warned-about
- http://www.elpassion.com/blog/ruby-gotchas/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment