In my fast Gem, in lib/fast/fast.rb:
If I write
module Fast
def self.dir path = nil
Fast::Dir.new( path ).list if path
Fast::Dir.new
end
[...]
end
And I call:
Fast.dir "lib" # And dir exists and have some files
I get a somewhat partial execution of Dir#list
While if I write
module Fast
def self.dir path = nil
unless path.nil?
the_dir = Fast::Dir.new path
the_dir.list
else
Fast::Dir.new
end
end
[...]
end
I get a right execution of Fast.dir
(also, if I execute Fast::Dir.new.list "lib" from anywhere else, it works. Specs, foundable in the files, are passing too)
Why? What's the difference? The rest of the code, Fast::Dir and all, is public, https://github.com/xaviervia/fast/tree/fbb9a50d73c9961c0004861a6302a9bfe3b626b3 and this is the version where the problem occurs.
I'm in a Ubuntu 11.10 rvm 1.6.9 ruby 1.9.3
I'm documenting this because the only thing that made it work was a non-relevant code restructuring, without further changes in any method behaviour. I tried everything else. I let this for research later, may be is a bug in Ruby.
I get exactly the same problem in:
Versus:
This is looking very much like a bug. Not a very significant one, but sneaky.