File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -723,6 +723,29 @@ Never use `::` for regular method invocation.
723723 bowling.score.should == 0
724724 ```
725725
726+ * Omit the outer braces around an implicit options hash.
727+
728+ ```Ruby
729+ # bad
730+ user.set({ name: ' John ' , age: 45, permissions: { read: true } })
731+
732+ # good
733+ User.set(name: ' John ' , age: 45, permissions: { read: true })
734+ ```
735+
736+ * Omit both the outer braces and parentheses for methods that are
737+ part of an internal DSL.
738+
739+ ```Ruby
740+ class Person < ActiveRecord::Base
741+ # bad
742+ validates(:name, { presence: true, length: { within: 1..10 } })
743+
744+ # good
745+ validates :name, presence: true, length: { within: 1..10 }
746+ end
747+ ```
748+
726749* Omit parentheses for method calls with no arguments.
727750
728751 ```Ruby
You can’t perform that action at this time.
0 commit comments