Hello all,
How do I know what 'require' to include after installing a ruby gem?
The reason I ask is because I just installed the pdf-writer gem, but
none of these work:
require 'pdf-writer'
require 'pdf'
require 'pdfwriter'
After installing a ruby gem, how do I know what string to put in my
require statement? thanks for any info.
···
--
Posted via http://www.ruby-forum.com/.
Read the documentation. While it is good practice that you just have
to require a file with the same name of the gem, this is not enforced.
In the case of pdf::writer, it is:
require 'pdf/writer'
This follows another popular convention, where modules are folders and
nested classes are files. All this can be found in the Pdf::Writer
manual, to be found at:
http://ruby-pdf.rubyforge.org/pdf-writer/manual/index.html
Regards,
Florian Gilcher
···
On Dec 8, 2009, at 8:44 AM, Omar Campos wrote:
Hello all,
How do I know what 'require' to include after installing a ruby gem?
The reason I ask is because I just installed the pdf-writer gem, but
none of these work:
require 'pdf-writer'
require 'pdf'
require 'pdfwriter'
After installing a ruby gem, how do I know what string to put in my
require statement? thanks for any info.
Usually, such information is included in the documentation of the gem. It can
be either in the API documentation which rubygems automatically creates when
you install the gem or on the gem website. In the case of pdf-writer, the
project's home page, which you can access from rubyforge, includes a manual
(http://ruby-pdf.rubyforge.org/pdf-writer/manual/manual.pdf\). At the beginning
of chapter 2, there's a simple example, which begins with the line
require 'pdf/writer'
I hope this helps
Stefano
···
On Tuesday 08 December 2009, Omar Campos wrote:
>Hello all,
>
> How do I know what 'require' to include after installing a ruby gem?
>The reason I ask is because I just installed the pdf-writer gem, but
>none of these work:
>
>require 'pdf-writer'
>require 'pdf'
>require 'pdfwriter'
>
> After installing a ruby gem, how do I know what string to put in my
>require statement? thanks for any info.
>