emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ruby-mode] Private/protected method definition layout in Ruby 2.1


From: Bozhidar Batsov
Subject: [ruby-mode] Private/protected method definition layout in Ruby 2.1
Date: Wed, 15 Jan 2014 16:41:33 +0200

Ruby 2.1 has made it possible to define private/protected/public methods on a per method basis (because a `def` now returns a symbol instead of nil). It means that now it’s possible to write code like this:

private def map(attribute, to:)
  @rules[attribute] = to
end

We currently don’t support such an indentation scheme, as `def` is always aligned with `end`:

private def map(attribute, to:)
              @rules[attribute] = to
            end

I’m not saying the first alignment is preferable, but it light of recent changes we did to accommodate similar alignment for `if/unless` it seems like a good idea to add a defcustom supporting the first style as well.

vim already added support for it (https://github.com/vim-ruby/vim-ruby/issues/190).

More on the topic can be read here http://www.sitepoint.com/look-ruby-2-1/.

-- 
Cheers,
Bozhidar


reply via email to

[Prev in Thread] Current Thread [Next in Thread]