From: Brian Candler Date: 2011-02-28T06:55:07+09:00 Subject: Re: Ensuring uniqueness of an object at creation time Abinoam Jr. wrote in post #984295: > In my specific piece of software I just have to make all the class a > "find_or_create" method, even if it doesn't have any uniqueness > constraints. This is because my parser is "agnostic", so I don't want > it to decide where to use "new" or "find_or_create". It has just to > use "find_or_create" in every object it tries to create. One option: class Object def self.find_or_create(*args,&blk) new(*args,&blk) end end Then you override it in those classes where you need to. -- Posted via http://www.ruby-forum.com/.