7stud -- wrote in post #1077511:
>> Is it possible for initialize to return an existing object instead
>> of a new instance?
>
>
> class Dog
>   def initialize
>     return 'hello'
>   end
> end
>
> d = Dog.new
> p d
>
> --output:--
> #<Dog:0x00000100925648

Thanks, but figured it out:
http://stackoverflow.com/questions/4888786/how-can-i-change-the-return-value-of-a-class-constructor-in-ruby

Can override the new method on the class to get the behavior I was 
talking about, e.g.

> class Dog
>   BARK = 'bark'
>   def self.new(arg=nil)
>     return BARK
>     end
>   end
 => nil
> Dog.new.object_id
 => 2046
> Dog.new.object_id
 => 2046

nice!

-- 
Posted via http://www.ruby-forum.com/.