The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Taming the File System Zoo

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Trans Onoma

Posts: 63
Nickname: transfire
Registered: Aug, 2005

Trans Onoma has programming for too long.
Taming the File System Zoo Posted: Aug 14, 2006 8:45 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Trans Onoma.
Original Post: Taming the File System Zoo
Feed Title: 7ransCode
Feed URL: http://feeds.feedburner.com/7ranscode
Feed Description: l33t c0d3 $p1n!
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Trans Onoma
Latest Posts From 7ransCode

Advertisement
I'm not quite sure I undestand why we have all these classes and modules: Dir, File, FileUtils, FileTest and Pathname. I understand what each of these does, of course, but I don't understand why the clearly related functionality has been spread about.

I think a FileSystem class or module would be in order -- a system we could use in much the same manner as we use the command shell to access our filesystem.


fs = FileSystem.new
fs.cd('/')
entries = fd.ls
entries.each do |e|
if fs.directory?(e)
...
else
fs.open(e) { |f| ... }
end
end


It's not so common that we open files and harbor them, even less so for directories. But the FileSystem can have those defined within it too, and there's no reason to even draw them up yourself. FileSystem will do it for you:


fs['afile.txt'] #=> <#FileSystem::File...>
fs['adir/'] #=> <#FileSystem::Dir...>


Clearly this pretty straightforward and quite convenient. But best of all, this single point of entry into all things "file system" may lead to more interesting possibilities, in some respect similar to what FUSE offers us, only confined to Ruby's realm.

I wonder too how remote file transfers might fit into this... interesting considerations all.

Read: Taming the File System Zoo

Topic: Hpricot the OhFourth Previous Topic   Next Topic Topic: Singleton 2 Legion

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use