Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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