Fix Ruby warnings

Start of fixing warnings provided by Ruby.

Still a **WIP** not ready to merge yet.

Ruby versions:

- [x] 2.1.2
- [ ] 2.1.1
- [ ] 2.1.0
- [ ] 2.0.0
- [x] 1.9.3
- [ ] 1.9.2
- [ ] 1.8.7

- Resolves #1088
Logged: https://bugs.ruby-lang.org/issues/9943