"Robert Feldt" <feldt / ce.chalmers.se> wrote in message
news:Pine.GSO.4.21.0201270020060.24752-100000 / godzilla.ce.chalmers.se...
> On Sun, 27 Jan 2002, Daniel Berger wrote:
>
> > require 'archive/tar'
> > require 'compress/bzip2'
> > archive = Archive::Tar.new( Dir.entries('.') ).compress('bzip2')
> >
>
> Why as a string? IMHO, its better with
>
>   archive = Archive::Tar.new(entries).compress(Bzip2)

I'm not even sure how this works.  Is a call to "entries" automatically
understood to be a method call from class "Dir"?  I'm a little confused.

>
> or even
>
>   archive = Bzip2.compress( Archive::Tar.new(entries) )

Perhaps we need a "Compress" superclass that's a subclass of "File".  I can
forsee two super-methods: compress and type.  The 'type' method would report
what type of compression a file had been compressed with (if that's
possible - I'm just throwing stuff out here).  Then Bzip, Gzip, etc, would
be subclasses of type "Compress".

Then again, maybe this isn't such a good idea because as you say...

> where archives need not know about compressors at all => less
> coupling. But maybe they need to know about them anyhow to detect and
> correctly handle tgz as inputs...
>
> /Robert

Sorta my thoughts exactly.  I mean, I realize that archives and compressors
are separate, but in the "real world" you'll almost never see un
uncompressed archive (unless you're the one who uncompressed it).  Then
again, there are plenty of non-archived files that need compressing.  I'm a
bit torn on the issue.

Just thinking out loud here folks...

Regards,

Dan