Hi Tom,

Thanks for your advice, I can now create a library of functions & simply call them with ease. Actually I saw double quotes in the example depicted in the tutorial @ http://www.rubycentral.com/book/tut_modules.html

Finally, Wanted your opinion if its better to use Require or to load a library... Is there any other benefit between them when compared head to head?

Thanks,

Vishal
 
--- "Tom" <[EMAIL PROTECTED]> wrote:
 
From: "Tom" <[EMAIL PROTECTED]>
Date: Fri, 4 Nov 2005 10:27:23 -0700
To: <[email protected]>
Subject: Re: [Wtr-general] Calling function from another RB file.

Require statements use single quotes.

In your driver.rb file try:

require 'watir'

require 'one.rb'

load "one.rb"

Act.contains_html("test")

Note:

Commenting out load “one.rb” as in

require 'watir'

require 'one.rb'

#load "one.rb"

Act.contains_html("test")

also works, so not sure if you need this load statement or not. I’m guessing not.

Tom


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Vishal Chavan
Sent: Friday, November 04, 2005 10:10 AM
To: [email protected]
Subject: [Wtr-general] Calling function from another RB file.

Hi All,

I wanted to seek your help in calling a function from another .RB file. Suppose I have a file one.rb which has following function:

require 'watir'
class Act
   def Act.contains_html( input )
    puts input
  end
end

Now from driver.rb file I want to call this Act.contains_html( input ) function. I have following code:

require 'watir'
require "one.rb"
load "one.rb"
Act.contains_html("test")

This does not work please advice how do I  get this working...

Thanks,

Vishal


 


Join SQAtester.com Community ---> http://www.sqatester.com/testersarea/joinus.htm


 

Join SQAtester.com Community ---> http://www.sqatester.com/testersarea/joinus.htm
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to