Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change creation of single line classes #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down