Giter Club home page Giter Club logo

Comments (26)

jwsloan avatar jwsloan commented on August 23, 2024 13

How about we vote here.
๐Ÿ‘Ž for

class foo
private
end

๐Ÿ‘ for

class foo
  private
end

from ramsey-cop.

alexmacarthur avatar alexmacarthur commented on August 23, 2024 9

I'd recommend switching to PHP.

from ramsey-cop.

jmmcduffie avatar jmmcduffie commented on August 23, 2024 3

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.

breese524 avatar breese524 commented on August 23, 2024 1

@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.

jasjar72 avatar jasjar72 commented on August 23, 2024 1

I voted my preference, but I'm a Ruby Newbie.

from ramsey-cop.

mellowfish avatar mellowfish commented on August 23, 2024

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.

joelwalden avatar joelwalden commented on August 23, 2024

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.

mellowfish avatar mellowfish commented on August 23, 2024

Yeah, I would prefer to line up with method definitions

from ramsey-cop.

rickpeyton avatar rickpeyton commented on August 23, 2024
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.

jwsloan avatar jwsloan commented on August 23, 2024

That's it. I like the private way. But it sounds like I'm in the minority.

from ramsey-cop.

breese524 avatar breese524 commented on August 23, 2024

@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.

mellowfish avatar mellowfish commented on August 23, 2024

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.

rickpeyton avatar rickpeyton commented on August 23, 2024

@joelwalden Your vote does not align with your comment. Is John threatening you?

from ramsey-cop.

jwsloan avatar jwsloan commented on August 23, 2024

Don't answer that, @joelwalden.

from ramsey-cop.

joelwalden avatar joelwalden commented on August 23, 2024

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.

rickpeyton avatar rickpeyton commented on August 23, 2024

I declare shenanigans

from ramsey-cop.

joelwalden avatar joelwalden commented on August 23, 2024

It looks like @jwsloan is voting against his preference. I don't think I understand anything.

from ramsey-cop.

jwsloan avatar jwsloan commented on August 23, 2024

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.

joelwalden avatar joelwalden commented on August 23, 2024

I thought that's what the thumbs up was. โž• , right?

from ramsey-cop.

spelfrey avatar spelfrey commented on August 23, 2024

@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.

jwsloan avatar jwsloan commented on August 23, 2024

I changed it before anyone voted...

from ramsey-cop.

joelwalden avatar joelwalden commented on August 23, 2024

I already had the screen loaded. Hence my confusion ๐Ÿ˜†

from ramsey-cop.

mellowfish avatar mellowfish commented on August 23, 2024

@breese524 reload your page and check you voted as expected

from ramsey-cop.

michael-garland avatar michael-garland commented on August 23, 2024

Looks like a tie at this point...

from ramsey-cop.

joshwhatk avatar joshwhatk commented on August 23, 2024

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.

jwsloan avatar jwsloan commented on August 23, 2024

After 24 hours, the winner is:

class foo
private
end

357aba5

from ramsey-cop.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.