10/18/2008

The Way Defining Member

When you want to define member belong to your class as next sample code.

class Data

attr_accessor :param, :index, :parent, :children



def initialize()

@index = index

@param = param

@children = []

@parent = nil

end

end



It is important that "attr_accessor" keyword in above codes.
Because words following attr_accessor are recognized as member by ruby.

No comments: