Hi all, I write the following problem to see if you can clarify me:
How I can modify an attribute of an object in a method?, Eg:

class Klass
  attr_accessor: attribute

  def initialize (number)
    @attribute = number
  end

  def get_attribute
    return @attribute
  end
end

object = Klass.new(5)

def adder(attribute)
  return attribute += 1
end

while true
  puts adder(objeto.get_attribute)
end

I explain: I want the attribute @attribute (which I pass as a parameter
to the method adder) will be modified in the method adder (adding 1)
constantly, printing its output in the while cycle.

In this case only 6 returns me constantly, that is, sum once and then
stop adding. As I can do in this case?

Sorry for bad english :)

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