From 7461c855f2dbc28091503a05005bcf5a77ccfad1 Mon Sep 17 00:00:00 2001 From: Brady Love and Emily Dobervich Date: Wed, 3 Jun 2015 09:09:08 -0700 Subject: [PATCH] Change creation of single line classes --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 146a727d7..61ffd787c 100644 --- a/README.md +++ b/README.md @@ -84,10 +84,10 @@ Be consistent. end # okish - class FooError < StandardError; end + FooError = Class.new(StandardError) # good - FooError = Class.new(StandardError) + class FooError < StandardError; end ``` * Avoid single-line methods. Although they are somewhat popular in the @@ -748,7 +748,7 @@ Be consistent. end # less good, but reasonable if there is no reasonable means to determine - the positive case. + # the positive case. # Prefer unless condition over ! condition unless failure? puts 'success' @@ -1599,7 +1599,7 @@ impact, though, as the block gets converted to a Proc. SOME_CONSTANT = 20 # inner public class - CustomErrorKlass = Class.new(StandardError) + class CustomErrorKlass < StandardError; end # afterwards we have attribute macros attr_reader :name