Hello Ayyappa
You have two basic options to prevent two outputs.
1) Delete the call in script1 as marked below.
2) Delete the call in script2 as marked below.
What is your goal?
Script 1
========
require 'rubygems'
require 'win32ole'
require 'watir'
class MyClass
def self.some_method
puts 'something'
end
end
MyClass.some_method #=> Option 1 - Delete this line
Script 2
========
require 'rubygems'
require 'win32ole'
require 'watir'
require 'D:\Waltair scripts\My wokings in waltair\script1.rb'
MyClass.some_method #=> Option 2 - Delete this line
Output of script 2 is
=================
something
something
Regards,
Darryl
On Feb 18, 5:30 am, ayyappa <[email protected]> wrote:
> Hi charley ,Thanks for the reply.
> But my question is there any other way to avoid two outputs without
> disturbing first script. i cant keep changing the source script for
> successfull running each time where i am calling the script.
>
> For example: i write a class related to add functionality i am using
> that in script1.i want to use the same add class in the script2 also,
> but as per your advise i have to stop the calling function script 1
> and run the script2.
>
> Can you please help me out in this
>
> On Feb 8, 9:14 pm, Charley Baker <[email protected]> wrote:
>
> > You seem to be calling MyClass.some_method from both scripts. Delete the
> > call from the first script.
>
> > -c
>
> > On Mon, Feb 8, 2010 at 5:37 AM, ayyappa <[email protected]> wrote:
> > > Hi guys I am new to watir . I am just working on basic concepts(Using
> > > Class ). when i run the script 2 , i got the output displaying two
> > > times. Can you please any one tell me any fault in my script
>
> > > Script 1
> > > ========
>
> > > require 'rubygems'
> > > require 'win32ole'
> > > require 'watir'
>
> > > class MyClass
> > > def self.some_method
> > > puts 'something'
> > > end
> > > end
>
> > > MyClass.some_method
>
> > > Script 2
> > > ========
> > > require 'rubygems'
> > > require 'win32ole'
> > > require 'watir'
> > > require 'D:\Waltair scripts\My wokings in waltair\script1.rb'
>
> > > MyClass.some_method
>
> > > Output of script 2 is
> > > =================
> > > something
> > > something
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Watir General" group.
> > > To post to this group, send email to [email protected]
> > > Before posting, please read the following guidelines:
> > >http://wiki.openqa.org/display/WTR/Support
> > > To unsubscribe from this group, send email to
> > > [email protected]<watir-general%2bunsubscr...@googlegroups.com>
> > > For more options, visit this group at
> > >http://groups.google.com/group/watir-general
>
>
--
You received this message because you are subscribed to the Google Groups
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines:
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/watir-general