Skip to content

Ruby outline doesn’t support modifier-style method visibility #64

@joeldrapper

Description

@joeldrapper

When using modifier-style method visibility in Ruby, the outline shows the modifier as if it applies to all subsequent method definitions, even though it only applies to the one method definition.

class Example
  private def foo 
  end
  
  def bar
  end
  
  protected def baz
  end
  
  def bing
  end
  
  public def zig
  end
end
Image

I think this is right for bare visibility modifiers.

class Example
  def foo
  end
  
  protected
  
  def bar
  end
  
  private
  
  def baz
  end
end
Image

When the modifier applies to only one method, I think it should be part of that method’s entry in the outline

private def bar

Additionally, a non-bare visibility modifier applied to a symbol rather than a method declaration should probably be excluded from the outline entirely.

class Example
  private :foo
end

Currently, this will appear in the outline as if all subsequent methods are private, which is not correct.

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