From: william robb Date: 2006-07-11T12:17:32+09:00 Subject: Re: calling a method for an object in a .each block cont./ch Thanks for the code. I will have to digest the syntax a bit to see exactly what you are doing here ... I had wondered what .freeze was good for. On that other topic, I think it was around V5 that turbo pascal became OO. The first version was what made Borland a success, as it was a dirt simple implementation of a real programming language, with one of the first IDEs. I still have the manual, complete, about the size of a paperback. I do remember thinking, when I encountered Pascal's Record data type; "I wish I could store a procedure in one of these fields ..." People at Borland must have thought that too, eh? Then came C, and Pascal kinda withered away ... Wasen't 'cool', but was a good workhorse. Thanks again, Will >>> You could for example create individual classes for suit, face and >>> maybe also for value implementing the enum pattern, so you end up >>> having just a single instance for hearts, clubs, face_up, face_down >>> etc. > > # poor mans enum pattern, > # for others see the RAA > > Suit = Struct.new :name > > class Suit > VALUES = [ > HEARTS = new("Heart").freeze, > CLUBS = new("Clubs").freeze, > DIAMONDS = new("Diamonds").freeze, > SPADES = new("Spades").freeze, > ].freeze [..etc...] -- Posted via http://www.ruby-forum.com/.