Hello,
I wanted to make a small command line script in Ruby. User inputs name
of Restaurant and type and average price. gets results for these add
info
a guy helped me to write simple class. I have tow questions from the
code below:
class Restaurant
attr_accessor :name :type :avg_price
def initialize(name, type, avg_price)
@name = name
@type = type
@avg_price = price
end
end
If we created the attr_accessors for the type, and price, and name
Why we need to use the Initialize method? because we need to set the
inputed values to it?
second question please:
in the code also i have a sub class called RestaurantList followed by <
Array
It seems to me it is a subclass. but the Array class doesn't exist in
the code? is it a built in class in ruby called Array? what it does
exactly?
Please make your answers as simple as you can make it so i can
understand it easily.
Thanks.
···
--
Posted via http://www.ruby-forum.com/.