Keyword "Include"

I am using PGPlot in a ruby script. Ruby has the keywords “require” and
“include” yet Ruby on Rails does not have the “include” keyword. I want
to insert this script in a controller. My ruby script starts:

require 'pgplot' include Pgplot . . .

How do I accomplish the same thing in my RoR controller?

require ‘pgplot’
class SomeController < ApplicationController
include Pgplot
end

Eric,

Thanks, works perfect now. I just didn’t see that the require keyword
needed to be outside of the controller class.

Cheers
TB

The require keyword includes files in your include path (e.g., lib,
your Ruby load path, and so on). The include keyword mixes modules
into classes, so it needs to be inside a class to be used. :slight_smile:

–Jeremy

On 1/2/07, Tom [email protected] wrote:

Posted via http://www.ruby-forum.com/.


My free Ruby e-book:
http://www.humblelittlerubybook.com/book/

My blogs:

http://www.rubyinpractice.com/