Function to flush the variable


#1

Hi,
Is there any function to flush the value from a variable. I am facing
problem while assiging a value to Ruby variable.


#2

On Fri, Jan 2, 2009 at 1:37 PM, Amit A. removed_email_address@domain.invalid
wrote:

Hi,
Is there any function to flush the value from a variable. I am facing
problem while assiging a value to Ruby variable.

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

What do you mean by flush? Remove the current value?
my_var = nil
should do that


#3

I am trying to use following code

Status=sheet1.getCellByPosition(5, I).Formula
ie.text_field(:name, “FieldName”).value =Status

and it works fine, but On itetrating this piece of code for multiple I/
Ps, variable ‘name’, retains its old value for some of the cases. I
identified this as a cache problem. Please suggest if there any flush
() type function or action in Ruby/watir to clear the garbage value.

actually there is function in C, i.e. flush which clears the garbage
value.

Andrew T. wrote:

On Fri, Jan 2, 2009 at 1:37 PM, Amit A. removed_email_address@domain.invalid
wrote:

Hi,
Is there any function to flush the value from a variable. I am facing
problem while assiging a value to Ruby variable.

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

What do you mean by flush? Remove the current value?
my_var = nil
should do that


#4

On Fri, Jan 2, 2009 at 1:49 PM, Amit A. removed_email_address@domain.invalid
wrote:

problem while assiging a value to Ruby variable.

A ‘variable’ with an uppercase first letter is actually a constant in
ruby
and you can only assign to it once.
Change ‘Status’ to ‘status’ and you should see it work


Andrew T.
http://ramblingsonrails.com
http://www.linkedin.com/in/andrewtimberlake

“I have never let my schooling interfere with my education” - Mark Twain


#5

Amit A. wrote:

actually there is function in C, i.e. flush which clears the garbage
value.

In ruby there is a method IO#flush which flushes an output stream the
same way
flush in C does. This has nothing to do with variables, however.

HTH,
Sebastian


#6

Andrew T. wrote:

A ‘variable’ with an uppercase first letter is actually a constant in ruby
and you can only assign to it once.
Change ‘Status’ to ‘status’ and you should see it work

In Ruby you can assign to a constant as many times as you like. You
will be scolded for it, but it’s allowed.

irb(main):001:0> IMA_CONST = “foo”
=> “foo”
irb(main):002:0> IMA_CONST = “bar”
(irb):2: warning: already initialized constant IMA_CONST
=> “bar”
irb(main):003:0> IMA_CONST = “baz”
(irb):3: warning: already initialized constant IMA_CONST
=> “baz”
irb(main):004:0> IMA_CONST
=> “baz”

-Michael