[#29911] [Bug #3231] Digest Does Not Build — Charlie Savage <redmine@...>

Bug #3231: Digest Does Not Build

19 messages 2010/05/01

[#29920] [Feature #3232] Loops (while/until) should return last statement value if any, like if/unless — Benoit Daloze <redmine@...>

Feature #3232: Loops (while/until) should return last statement value if any, like if/unless

9 messages 2010/05/01

[#29997] years in Time.utc — Xavier Noria <fxn@...>

Does anyone have a precise statement about the years supported by

13 messages 2010/05/04

[#30010] [Bug #3248] extension 'tk' is finding tclConfig.sh and tkConfig.sh incorrectly — Luis Lavena <redmine@...>

Bug #3248: extension 'tk' is finding tclConfig.sh and tkConfig.sh incorrectly

9 messages 2010/05/05

[#30226] [Bug #3288] Segmentation fault - activesupport-3.0.0.beta3/lib/active_support/callbacks.rb:88 — Szymon Jeż <redmine@...>

Bug #3288: Segmentation fault - activesupport-3.0.0.beta3/lib/active_support/callbacks.rb:88

10 messages 2010/05/13

[#30358] tk doesn't startup well in doze — Roger Pack <rogerdpack2@...>

Currently with 1.9.x and tk 8.5,the following occurs

12 messages 2010/05/22

[ruby-core:30441] Re: [Feature #3346] __DIR__ revisted

From: Benoit Daloze <eregontp@...>
Date: 2010-05-26 13:03:14 UTC
List: ruby-core #30441
Hi,
On 26 May 2010 14:17, U.Nakamura <usa@garbagecollect.jp> wrote:
> Hello,
>
> In message "[ruby-core:30436] [Feature #3346] __DIR__ revisted"
> n May.26,2010 20:59:48, <redmine@ruby-lang.org> wrote:
>> I like __DIR__.
>
> I like Kernel#__dir__.
>
>
> Regards,
> --
> U.Nakamura <usa@garbagecollect.jp>
>
I prefer __DIR__.

( as a keyword,
  because it's clearly the same family with __FILE__,
  and it's a constant (so in uppercase) )

My first use would be things like Dir[File.join(__DIR__,'*.rb')].each
{ |f| require f }
That's only because I am sometimes too lazy to "require_relative" all
the files under the same dir.
But maybe that's not the best way to do it, tough.
Currently, there is also another possibility, which is kind of a hack:
Dir[File.expand_path("../*.rb",__FILE__)].each { |f| require f }

Just some ideas in the air for this case:
- require_relatives
- require_relative '*.rb'
- require_relative '*' (then assume we want only .rb files)
- require_relative (then the meaning would be "require the relative
stuff, what is relative to this")
The 2nd and 3rd one obviously more flexible as they accept a glob
matching pattern.

Anyway, there are still many cases in which __DIR__ would be useful,
even if that's kind of low-level stuff.

Regards,
B.D.

In This Thread