f



[ANN] - ptools 1.1.1

Hi all,

This is just a quick announcement to let y'all know that I've released =
ptools=20
1.1.1 today.

What is it?
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Power tools for the File class.  Additional methods include which, =
whereis,=20
head, tail, middle, wc, null, nl_convert, touch and binary?.

What's new?
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
This release adds the File.null and File.binary? methods.  The former =
returns=20
the null device on your system  The latter returns whether or not the =
file in=20
question is a binary file (using a simple best-guess algorithm).

Where is it?
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
You can get it via gems, the RAA or RubyForge.

gem install ptools
http://raa.ruby-lang.org/project/ptools/
http://rubyforge.org/projects/shards/

Enjoy!

- Dan

PS - I forgot to put the dependency in the gem, but Windows users will =
need=20
win32-file-stat.  If you're using the latest one-click installer, you've =

already got it.


This communication is the property of Qwest and may contain confidential =
or
privileged information. Unauthorized use of this communication is =
strictly=20
prohibited and may be unlawful.  If you have received this communication =

in error, please immediately notify the sender by reply e-mail and =
destroy=20
all copies of the communication and any attachments.

0
8/23/2006 8:41:46 PM
comp.lang.ruby 48886 articles. 0 followers. Post Follow

2 Replies
842 Views

Similar Articles

[PageSpeed] 8

fr daniel:
# Power tools for the File class.  Additional methods include=20
# which, whereis,=20
# head, tail, middle, wc, null, nl_convert, touch and binary?.

very cool and helpful. now win users aren't left so far behind..

maybe, i can create a more efficient grep -r now, one that does not =
include binary files. Will #binary? work on unix too?

thanks for ptools -botp


0
botp (987)
8/24/2006 3:05:56 AM
Peña, Botp wrote:

> fr daniel:
> # Power tools for the File class.  Additional methods include
> # which, whereis,
> # head, tail, middle, wc, null, nl_convert, touch and binary?.
> 
> very cool and helpful. now win users aren't left so far behind..
> 
> maybe, i can create a more efficient grep -r now, one that does not
> include binary files. Will #binary? work on unix too?

Yep. In a *nix file read/write context, specifying binary does nothing,
because Unix doesn't honor the distinction, so the test "binary?" should
always "work". It is only meaningful in Windows.

In fact, the entire "binary" idea was created to deal with the weird Windows
line endings. If "binary" is specified, the file read/write system stops
translating "\n\r" to "\n" on read, and "\n" to "\n\r" on write. That's
all.

A variation on "binary?" might read a file to see if it deviates from 7-bit
ASCII, but this will fail for perfectly valid Unicode text files. So IMHO
it's a bad idea.

-- 
Paul Lutus
http://www.arachnoid.com
0
nospam248 (2592)
8/24/2006 4:06:44 AM
Reply: