Skip to content

Fix contributing guide to reflect preferred position on indentation #4685

Merged
merged 1 commit into from Jan 26, 2012
@fxn fxn merged commit 70b0598 into rails:master Jan 26, 2012
@amatsuda
Ruby on Rails member

:metal:

Ruby on Rails member

I've been secretly outdenting these for quite some time. :trollface:

Nice... But I can't wait for the day until tabs are used for indentation!

It changes everything. Again.

OMG! Rails isn't for beginners anymore!

Personally, I'm a fan of outdenting the private/protected declaration itself, like this:

class Foo

  def public_method
    # method definition goes here
  end

private

  def private_method
    # method definition goes here
  end

end

This helps private/protected stand out and is similar to the common indentation pattern for begin/rescue/ensure/end.

I tend to indent methods after private/protected because it makes them stand out. @sferik's approach works just as well.

I'm +1 for @sferik's suggestion

Hey how about this

class Module
  alias :______________________________PRIVATE______________________________  :private
end

class Foo

  def hello
    print "hello"
    world
  end

______________________________PRIVATE______________________________


  def world
    print " world!\n"
  end
end

Foo.new.hello
Foo.new.world # => dissed!

@sferik I like your style!

@sferik I am with you on this. Outdenting make codes more readable as eyes would be able to catch the differences easily. 👎 on this change

Definitely with @sferik on this one. Making the distinction makes scanning code much faster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.