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: <code> require ''pgplot'' include Pgplot . . . </code> How do I accomplish the same thing in my RoR controller? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
require ''pgplot'' class SomeController < ApplicationController include Pgplot end Tom wrote:> > 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: > > <code> > > > . > . > . > </code> > > How do I accomplish the same thing in my RoR controller? >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Eric, Thanks, works perfect now. I just didn''t see that the require keyword needed to be outside of the controller class. Cheers TB -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. :) --Jeremy On 1/2/07, Tom <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Eric, > > Thanks, works perfect now. I just didn''t see that the require keyword > needed to be outside of the controller class. > > Cheers > TB > > -- > Posted via http://www.ruby-forum.com/. > > > >-- My free Ruby e-book: http://www.humblelittlerubybook.com/book/ My blogs: http://www.mrneighborly.com/ http://www.rubyinpractice.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---