@@ -214,7 +214,7 @@ Use Unix-style line endings.footnote:[*BSD/Solaris/Linux/macOS users are covered
214214====
215215If you're using Git you might want to add the following configuration setting to protect your project from Windows line endings creeping in:
216216
217- [source,bash ]
217+ [source,shell ]
218218----
219219$ git config --global core.autocrlf true
220220----
@@ -328,7 +328,7 @@ foo&.bar
328328Avoid chaining of `&.`. Replace with `.` and an explicit check.
329329E.g. if users are guaranteed to have an address and addresses are guaranteed to have a zip code:
330330
331- [source, ruby]
331+ [source,ruby]
332332----
333333# bad
334334user&.address&.zip
@@ -338,7 +338,7 @@ user && user.address.zip
338338----
339339
340340If such a change introduces excessive conditional logic, consider other approaches, such as delegation:
341- [source, ruby]
341+ [source,ruby]
342342----
343343# bad
344344user && user.address && user.address.zip
@@ -3842,12 +3842,12 @@ This convention tends to reduce repetitive boilerplate in such classes.
38423842[source,ruby]
38433843----
38443844class TestClass
3845- # bad -- more work when class renamed/method moved
3845+ # bad - more work when class renamed/method moved
38463846 def self.call(param1, param2)
38473847 TestClass.new(param1).call(param2)
38483848 end
38493849
3850- # bad -- more verbose than necessary
3850+ # bad - more verbose than necessary
38513851 def self.call(param1, param2)
38523852 self.new(param1).call(param2)
38533853 end
@@ -5505,9 +5505,10 @@ class Organization < ActiveRecord::Base
55055505end
55065506
55075507linux_organization = Organization.find(...)
5508- # BAD - violates privacy
5508+
5509+ # bad - violates privacy
55095510linux_organization.send(:reset_token)
5510- # GOOD - should throw an exception
5511+ # good - should throw an exception
55115512linux_organization.public_send(:reset_token)
55125513----
55135514
@@ -5523,10 +5524,10 @@ u1 = UDPSocket.new
55235524u1.bind('127.0.0.1', 4913)
55245525u2 = UDPSocket.new
55255526u2.connect('127.0.0.1', 4913)
5526- # Won't send a message to the receiver obj.
5527- # Instead it will send a message via UDP socket.
5527+
5528+ # bad - Won't send a message to the receiver object. Instead it will send a message via UDP socket.
55285529u2.send :sleep, 0
5529- # Will actually send a message to the receiver obj .
5530+ # good - Will actually send a message to the receiver object .
55305531u2.__send__ ...
55315532----
55325533
0 commit comments