Extreme Noob wrote:
> Wow, didn't know about that =() function. Thanks for the help
> 
> 

Look at this class:


class Dog
  def initialize(name)
    @name = name
  end

  def name=(a_name)
    @name = a_name
  end

  def name
    return @name
  end
end


d = Dog.new("Spot")
puts d.name

d.name = "Rover"
puts d.name


The Dog class above is equivalent to:

class Dog
  attr_accessor :name

  def initialize(name)
    @name = name
  end

end


In other words,  the line:

attr_accessor :name

creates the methods "name=" and "name" for you.
-- 
Posted via http://www.ruby-forum.com/.