Skip to content

Private and Protected indentation #332

Closed
@garrypolley

Description

@garrypolley

This is more of a question right now rather than a suggested change.

I've noticed a few examples online with Ruby/Rails code that indent an extra level for the sections that are private and protected for code. I think this makes it a lot easier to read the code and figure out where private and protected areas of the class are at within the code. What are reasons for and against this method of extra indenting?

Here is an example of what I mean:

class MyAwesomeClass

  def public_method_1
    # do stuff
  end

  def public_method_2
    # do stuff
  end

  protected
    def potected_method_1
       # do stuff
    end

    def protected_method_2
      # do stuff
    end

  private
    def private_method_1
      # do stuff
    end

    def private_method_2
      # do stuff
    end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions