From: 7stud -- Date: 2012-09-20T13:09:18+09:00 Subject: Re: Class variables class Card attr_accessor :suit attr_accessor :value attr_accessor :name attr_accessor :picture attr_accessor :hcp Those are all method calls. Do this instead: attr_accessor :suit, :value, :name, :picture, :hcp Don't do this: def new(value, suit) @value = value @suit = suit end Do this instead: def initialize(value, suit) @value = value @suite = suit end obj = MyClass.new(3, 'diamonds') Return statements aren't used so much in ruby because a method returns the result of the last statement that was evaluated. So don't do this: def hcp() return @hcp end Do this: def hcp @hcp end However, calling attr_accessor :hcp is equivalent to writing the following in your class: def hcp @hcp end def hcp=(val) @hcp = val end The implementation of class variables in ruby: @@suits = ['C', 'D', 'H', 'S'] isn't what you would expect, so no one uses them. Rubyists use class instance variables instead, e.g. class Dog @my_var end -- Posted via http://www.ruby-forum.com/.