Skip to content
This repository was archived by the owner on Feb 12, 2019. It is now read-only.
This repository was archived by the owner on Feb 12, 2019. It is now read-only.

Improve class method printing #42

@AlanFoster

Description

@AlanFoster

Rails in particular has a lot of class methods within its API. I'm not massively opinionated here, but perhaps the convention should be to drop brackets on method calls within class bodies

Input

class MyClass
  helper :all
  before_action :hello_world
  include FooBarBaz

  def self.foo
    puts "foo"
  end
  private_class_method :foo

  private_class_method def self.bar
     puts "bar"
  end
end

Current output

class MyClass
  helper(:all)
  before_action(:hello_world)
  include(FooBarBaz)
  def self.foo
    puts 'foo'
  end
  private_class_method(:foo)
  private_class_method(def self.bar
    puts 'bar'
  end)
end

Expected Output

Brackets are dropped from method/command calls within the class body

class MyClass
  helper :all
  before_action :hello_world
  include FooBarBaz

  def self.foo
    puts 'foo'
  end
  private_class_method :foo

  private_class_method def self.bar
    puts 'bar'
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions