Comments (26)
How about we vote here.
๐ for
class foo
private
end
๐ for
class foo
private
end
from ramsey-cop.
I'd recommend switching to PHP.
from ramsey-cop.
I prefer having private
and protected
at the same level as class
because of the fact that they start a new section of the class definition that can't be closed (except by opening another new section). Does that make sense? In other words, once you've declared private
the rest of the class is private. I view it like having a method with a rescue
clause but no begin
.
from ramsey-cop.
@mellowfish I'm not super dogmatic on code style, I can roll with the group's preference. I'll generally ask why on anything that seems unusual, I tend to learn new things that way.
from ramsey-cop.
I voted my preference, but I'm a Ruby Newbie.
from ramsey-cop.
Indent, like, the same level as method definitions, or the same level as the surrounding module/class?
class A
private
def b; end
end
# or
class A
private
def b; end
end
from ramsey-cop.
I prefer them at the same level as method definitions. Plenty easy to read, so there's no need to add additional whitespace.
from ramsey-cop.
Yeah, I would prefer to line up with method definitions
from ramsey-cop.
class Foo
def bar
end
private # this
def baz
end
protected # versus this
def quux
end
end
This is the question, right?
protected
is the way I go.
from ramsey-cop.
That's it. I like the private
way. But it sounds like I'm in the minority.
from ramsey-cop.
@jwsloan You and me both. I've always felt those keywords were important enough that they needed to stand out. Maybe we over value what they communicate.
from ramsey-cop.
I understand the private version. But it has always felt weird. I am ok either way if we want to change it.
from ramsey-cop.
@joelwalden Your vote does not align with your comment. Is John threatening you?
from ramsey-cop.
Don't answer that, @joelwalden.
from ramsey-cop.
I thought thumbs-down was for the indented-method-level one? I mean... I hit the wrong one initially but I changed when I got a Venmo from @jwsloan
from ramsey-cop.
I declare shenanigans
from ramsey-cop.
It looks like @jwsloan is voting against his preference. I don't think I understand anything.
from ramsey-cop.
I like private
to be at the same level as class
.
But I'm not trying to influence anyone... so I made the community version the thumbs-up version.
from ramsey-cop.
I thought that's what the thumbs up was. โ , right?
from ramsey-cop.
@jwsloan Quit editing the vote details comment. I can't tell if you are changing it to match the votes or not.
from ramsey-cop.
I changed it before anyone voted...
from ramsey-cop.
I already had the screen loaded. Hence my confusion ๐
from ramsey-cop.
@breese524 reload your page and check you voted as expected
from ramsey-cop.
Looks like a tie at this point...
from ramsey-cop.
As I understand ruby, it appears that it is almost a "title" within the class that says that denotes everything after it as the respective access level (protected, private), correct?
In my experience, anything that would change the meaning or context of code after it should be written with a higher visibility so as not to be skipped over by humans skimming code.
from ramsey-cop.
After 24 hours, the winner is:
class foo
private
end
from ramsey-cop.
Related Issues (11)
- Favor double quotes over single quotes HOT 6
- Layout/ExtraSpacing HOT 16
- Length Metrics/{Block/Class/Method/Module}Length HOT 13
- Gem documentation process (repo vs wiki) HOT 5
- Discuss: Increase line length HOT 3
- Style/NumericLiterals HOT 8
- Require frozen string literals HOT 20
- Remove "Prefer single-quoted strings inside interpolations." HOT 4
- Discuss adjustingย Metrics/MethodLength and Metrics/AbcSize HOT 6
- Add rubocop-rails as a dependancy HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ramsey-cop.