Use Ruby on Rails Coding Conventions for code examples in the guides

* Indent after private/protected
* Ruby >= 1.9 syntax for hashes
* Prefer method { do_stuff } instead of method{do_stuff} for single-line blocks.

[ci skip]
Merge pull request #12155 from jetthoughts/reformat_guides_code_examples

Use Ruby on Rails Coding Conventions for code examples in the guides