Add methods to directory.rb