On Aug 14, 11:33 am, "Wolfgang N?dasi-donner" <ed.oda... / wonado.de>
wrote:
> Daniel Berger wrote:
> > On Aug 12, 3:01 pm, "Wolfgang N?dasi-donner" <ed.oda... / wonado.de>
> > wrote:
> >> ------------------------------------------------------------------------
> >>      Returns whether or not +path+ is empty. Returns false if +path+ is
> >>      not a directory, or contains any files other than '.' or '..'.
>
> >> C:\Dokumente und Einstellungen\wolfgang>irb
> >> irb(main):001:0> Dir::empty?('./')
> >> NoMethodError: undefined method `empty?' for Dir:Class
> >>         from (irb):1
> >> irb(main):002:0>
>
> > You're picking up Dir.empty? from win32-dir, which ships with the one-
> > click installer. In order to use it, you have to require it first. :)
>
> Booofff... - thank you for this information!
>
> irb(main):001:0> require 'win32/dir'
> => true
> irb(main):002:0> Dir::empty?('./')
> => false
>
> Unfortunately it is not visible in the ri output where the method comes
> from.

That's an excellent point Wolfgang. There ought to be a way within ri
for a user to distinguish between a core method and a method added on
by a 3rd party library. I haven't double checked the ri options, but I
don't think there's a way.

If not, we should probably discuss (here or on ruby-core) if it's
feasible and, if so, what the output should look like.

Or, we could collectively decide that, when modifying core classes, we
should stick a tag of some sort on the method doc itself, either so
that it shows up literally in the output, or something rdoc can latch
onto. For example, the actual comments look like this:

# Returns whether or not +path+ is empty.  Returns false if +path+
# is not a directory, or contains any files other than '.' or '..'.
#
def self.empty?(path)
   ...
end

Perhaps I should add this at the bottom of each comment?

# library: win32-dir

Dunno. What do people think?

Regards,

Dan