David Garamond <lists / zara.6.isreserved.com> writes: > Since I don't like code in nested modules to be indented so deeply, I > tend to do this: > > module Foo; module Bar; module Baz; end end end > > module Foo::Bar::Baz > ... # only 1 level indented > end > > I was wondering how people that prefer > > module Foo > module Bar > module Baz > ... > end > end > end > > write their code, especially with auto-indenting editor, like emacs + > ruby-mode. Do you just let the editor indent it deeply or do you > resist the indentation and reverse what the editor does for you? Or, > do you tend to avoid nested modules because of this? | irb(main):001:0> module A; FOO = 4; module B; end; end | => nil | irb(main):002:0> module A::B | irb(main):003:1> puts FOO | irb(main):004:1> end | NameError: uninitialized constant A::B::FOO | from (irb):3 | irb(main):005:0> module A | irb(main):006:1> module B | irb(main):007:2> puts FOO | irb(main):008:2> end | irb(main):009:1> end | 4