跟著書一步一步學ruby....難題待解

跟著書一步一步學ruby....難題待解

其中一課.....

class Person
 def name
  @name
 end 
 def gender
  @gender
 end
 def age
  @age
 end
end

people = Person.new('Tom','male','15')
puts people.name
puts people.gender
puts people.age


照敲了一次, 但運行的時候出現:

>ruby class.rb
class.rb:13:in `initialize': wrong number of arguments (3 for 0) (ArgumentError)
    from class.rb:13:in `new'
    from class.rb:13
>Exit code: 1

甚麼問題????
people = Person.new('Tom','male','15')
是说调用Person的静态方法new,传三个参数进去,
而这个类的initialize(构造方法)你又没创建,那就不会有接受三个参数的方法存在,当然提示没这个方法在了.