From: botp Date: 2009-05-27T13:32:08+09:00 Subject: Re: Initialize not being called on objects created from literals On Wed, May 27, 2009 at 8:26 AM, Oliver Saunders wrote: > Initialize doesn't appear to get called. > > class Object >  def initialize >    @foo = 'bar' >  end >  attr_reader :foo > end > > a = Object.new # => # see relation bw initialize and new > a.foo # => "bar" > 'string'.foo # => nil > //.foo # => nil > > I want to have //.foo and 'string.foo give me "bar" as they should. How > can I do that? try defining a method, eg >> class Object >> def foo >> "bar" >> end >> end => nil >> 1.foo => "bar" >> //.foo => "bar"