unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [ruby-mode] Private/protected method definition layout in Ruby 2.1
@ 2014-01-15 14:41 Bozhidar Batsov
  2014-01-15 16:24 ` Stefan Monnier
  2014-01-16  5:47 ` Dmitry Gutov
  0 siblings, 2 replies; 11+ messages in thread
From: Bozhidar Batsov @ 2014-01-15 14:41 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 887 bytes --]

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


[-- Attachment #2: Type: text/html, Size: 1794 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-01-17  3:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-15 14:41 [ruby-mode] Private/protected method definition layout in Ruby 2.1 Bozhidar Batsov
2014-01-15 16:24 ` Stefan Monnier
2014-01-15 18:18   ` Dmitry Gutov
2014-01-15 18:51     ` Stefan Monnier
2014-01-16  5:47 ` Dmitry Gutov
2014-01-16 10:15   ` Bozhidar Batsov
2014-01-16 13:37     ` Dmitry Gutov
2014-01-16 14:26       ` Bozhidar Batsov
2014-01-16 18:40         ` Dmitry Gutov
2014-01-16 19:38           ` Bozhidar Batsov
2014-01-17  3:17             ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).