------art_13257_9365032.1202233039135
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Thanks Day, but this is just a simplification of what I need

@Andrew Stone, thanks instance_variable_set makes it's work, but what if i
need the data inside too... for example

def call_other(var1,var2)
  max   
  if(var1 0)
    var1  and max
  else
    var1 + ax
  end
  var2  and max
end


BTW, can you explain the line of code "c :@xpos", didn't get it

Thanks again

On Feb 4, 2008 11:03 PM, Andrew Stone <stonelists / gmail.com> wrote:

> >  def some
> >     call_other(@xpos,@ypos)
> >  end
> >
> >  def more
> >     call_other(@other,@another)
> >  end
> >
>
> This worked:
> class Test
>  attr_reader :xpos
>
>  def initialize
>    @xpos  
>  end
>
>  def some
>    p "before call: #{@xpos}"
>    #notice the colon
>    c :@xpos
>    p "after call: #{@xpos}"
>  end
>
>  def call_other(var)
>    max  
>    self.instance_variable_set(var, rand(max))
>  end
> end
>
> begin
>  t  est.new
>  t.some
> end
>
> wyz@local ~ $ ruby test.rb
> "before call: 0"
> "after call: 7"
>
> wyz@local ~ $ ruby test.rb
> "before call: 0"
> "after call: 2"
>
> Warning: I'm not feeling well and the NyQuil is kicking in... :/
>
> --
> Andrew Stone
>

------art_13257_9365032.1202233039135--