Last active
June 21, 2023 12:36
-
-
Save prdanelli/7187638719c312460692feed5dcf3fb0 to your computer and use it in GitHub Desktop.
No Space Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bad | |
class MyClass | |
COSNT_NAME = "boz" | |
attr_reader :foo, :bar, :baz | |
def initialize(foo, bar, baz) | |
@foo = foo | |
@bar = bar | |
@baz = baz | |
end | |
def call | |
return if foo.blank? | |
another_method(foo) | |
if baz == "test" | |
baz.each do |b| | |
b["soemthing"] | |
SomeJob.new(b).perform_later | |
end | |
else | |
"unknown" | |
end | |
"Test" | |
end | |
def another_method(foo) | |
"do something else" | |
end | |
end | |
# Good | |
class MyClass | |
COSNT_NAME = "boz" | |
attr_reader :foo, :bar, :baz | |
def initialize(foo, bar, baz) | |
@foo = foo | |
@bar = bar | |
@baz = baz | |
end | |
def call | |
return if foo.blank? | |
another_method(foo) | |
if baz == "test" | |
baz.each do |b| | |
b["soemthing"] | |
SomeJob.new(b).perform_later | |
end | |
else | |
"unknown" | |
end | |
"Test" | |
end | |
def another_method(foo) | |
"do something else" | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment