lib/fusefs/metadir.rb
def pathmethod(method, path,*args)
            base,rest = split_path(path)

            case
            when ! base
                #request for the root of our fs
                yield(nil,*args)
            when ! rest
                #base is the filename, no more directories to traverse
                yield(base,*args)
            when @subdirs.has_key?(base)
                #base is a subdirectory, pass it on if we can
                begin
                    @subdirs[base].send(method,rest,*args)
                rescue NoMethodError
                    #Oh well
                    return DEFAULT_FS.send(method,rest,*args)
                rescue ArgumentError
                    #can_mkdir,mkdir
                    if args.pop.nil?
                        #possibly a default arg, try sending again with one fewer arg
                        @subdirs[base].send(method,rest,*args)
                    else
                        #definitely not a default arg, reraise
                        Kernel.raise
                    end
                end
            else
                #return the default response
                return DEFAULT_FS.send(method,path,*args)
            end
        end
#All our FuseFS methods follow the same pattern...
All our FuseFS methods follow the same pattern
All our FuseFS methods follow the same pattern
def pathmethod(method, path,*args)
            base,rest = split_path(path)
            case
            when ! base
                yield(nil,*args)
            when ! rest
                yield(base,*args)
            when @subdirs.has_key?(base)
                begin
                    @subdirs[base].send(method,rest,*args)
                rescue NoMethodError
                    return DEFAULT_FS.send(method,rest,*args)
                rescue ArgumentError
                    if args.pop.nil?
                        @subdirs[base].send(method,rest,*args)
                    else
                        Kernel.raise
                    end
                end
            else
                return DEFAULT_FS.send(method,path,*args)
            end
        end
def pathmethod ( method , path , * args ) base , rest = split_path ( path ) case when ! base yield ( nil , * args ) when ! rest yield ( base , * args ) when @subdirs . has_key? ( base ) begin @subdirs [ base ] . send ( method , rest , * args ) rescue NoMethodError return DEFAULT_FS . send ( method , rest , * args ) rescue ArgumentError if args . pop . nil? @subdirs [ base ] . send ( method , rest , * args ) else Kernel . raise end end else return DEFAULT_FS . send ( method , path , * args ) end end
All our FuseFS methods follow the same pattern...
All our FuseFS methods follow the same pattern ...
#request for the root of our fs #base is the filename, no more directories to traverse #base is a subdirectory, pass it on if we can #Oh well #can_mkdir,mkdir #possibly a default arg, try sending again with one fewer arg #definitely not a default arg, reraise #return the default response
method
path
args