3-22 Ruby 编码规则(个人整理)
编码规则
https://github.com/thoughtbot/guides/tree/master/style/ruby
*Use a trailing comma after each item in a multi-line list, including the last item.
a = [
:one,
:two,
:three,
]
- Prefer
detectoverfind. 0d819844 - Prefer
selectoverfind_all. 0d819844 - Prefer
mapovercollect. 0d819844 - Prefer
reduceoverinject. #237 - Prefer double quotes for strings. #174
- Prefer
&&and||overandandor. #153 - Prefer
!overnot. #195 - Prefer
&:method_nameto{ |item| item.method_name }for simple method calls. #183 - Prefer
ifoverunless. #254
- Use
def self.method, notdef Class.methodorclass << self. - Order class methods above instance methods.
浙公网安备 33010602011771号