[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Where to install non-ruby files in ruby module

Dan Fitzpatrick

1/13/2005 7:04:00 PM

I am creating my first rbuy app - porting FPDF (PHP used to create PDF
files) http:... to ruby and was wondering where the font
definition files should be installed. These files are text data files
used to create new font definitions for PDFs and are not ruby code.
Should they be a subdirectory of the fpdf module dir or some place
completely outside the ruby libs area?

Thanks,

Dan



4 Answers

Austin Ziegler

1/13/2005 8:40:00 PM

0

On Fri, 14 Jan 2005 04:04:16 +0900, Dan Fitzpatrick <dan@eparklabs.com> wrote:
> I am creating my first rbuy app - porting FPDF (PHP used to create PDF
> files) http:... to ruby and was wondering where the font
> definition files should be installed. These files are text data files
> used to create new font definitions for PDFs and are not ruby code.
> Should they be a subdirectory of the fpdf module dir or some place
> completely outside the ruby libs area?

Dan:

I have actually ported Cpdf to PDF some time back. It's PDF::Writer.

You can see what I've done there on its RubyForge project.

-austin
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca


Pete Elmore

1/13/2005 9:05:00 PM

0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is there a way to get Ruby to print the definition of a class or method,
like 'see' in Forth? I think it would be very useful to be able
(especially in irb) to see how a method in a running instance of Ruby is
defined. Is this possible?

Thanks in advance.

Pete
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Debian - http://enigmail....

iD8DBQFB5uMnv24lB609Ih8RAv+7AKCuEd67Cqvf6WxLgyopyUqk+UJmpQCdFxl6
TyIggatTDYxfwZS3RHYFKPQ=
=M7wO
-----END PGP SIGNATURE-----


Austin Ziegler

1/13/2005 9:58:00 PM

0

On Fri, 14 Jan 2005 06:05:19 +0900, Pete Elmore <pete@petta-tech.com> wrote:
> Is there a way to get Ruby to print the definition of a class or method,
> like 'see' in Forth? I think it would be very useful to be able
> (especially in irb) to see how a method in a running instance of Ruby is
> defined. Is this possible?
>
> Thanks in advance.

Not without some parsing of the text involved as it's being handled or
parsing the definition. The Ruby interpreter discards the text
definition of the method as soon as it's compiled.

-austin
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca


Pete Elmore

1/13/2005 11:10:00 PM

0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Austin Ziegler wrote:
| Not without some parsing of the text involved as it's being handled or
| parsing the definition. The Ruby interpreter discards the text
| definition of the method as soon as it's compiled.

So does Forth (sorry to be referring to such an obscure language, but
it's the only one I know of that has this useful feature).

For example, I define 'fnext' as below,
: fnext ( fib[n] fib[n+1] -- fib[n+1] fib[n+2] )
~ swap
~ over
~ +
;

Then I type 'see fnext' to see the definition:
see fnext
: fnext
~ swap over + ;
The formatting and the comment are gone, so it looks like it's just
converting from its own internal representation to something printable.

How are definitions represented internally? What files should I look at
to see this? Is a patch implementing such a feature likely to be
accepted? Does this seem useful to anyone besides me?

IMHO, this would be a great help for debugging ("puts doesn't work
because this module is re-defining it!") as well as learning about the
language and built-in features. Not to mention its effect on the size
of quines. :p

Pete
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Debian - http://enigmail....

iD8DBQFB5wB4v24lB609Ih8RArxBAJ4x7vdkzhUGsv1B7tnDNy32Q1PH8QCguQpm
bkddUdqKqoWHuaAhXGmAyZM=
=tLJA
-----END PGP SIGNATURE-----