Where to install non-ruby files in ruby module

D

Dan Fitzpatrick

I am creating my first rbuy app - porting FPDF (PHP used to create PDF
files) http://fpdf.org 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
 
A

Austin Ziegler

I am creating my first rbuy app - porting FPDF (PHP used to create PDF
files) http://fpdf.org 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
 
P

Pete Elmore

-----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.mozdev.org

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

Austin Ziegler

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
 
P

Pete Elmore

-----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.mozdev.org

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top