On Tue, Aug 12, 2008 at 4:37 PM, Ben Aurel <ben.aurel / gmail.com> wrote:
> #!/usr/bin/env ruby
> # The Unix tool 'ls' implemented in ruby
> class Ls
>        @path = ""

This is not doing what you think it does - when @path = "" is
executed, you are in the context of the class object Ls, which will
acquire a "class instance variable" @path, which is then never used
(or, indeed, accessible). If your intent was to have a default path of
"" if none was given, you need the next line to be

>        def initialize(path)

def initialize(path = "")

but since immediately after you are checking the path

>                if File.exists?(path) && File.directory?(path)

you might as well let it be nil if not supplied, and omit the default
altogether.

martin