Hi --
This probably lies somewhere between obfuscated and pointless, but I
thought it was a fun example of Ruby's nimbleness:
class C
attr_reader :to_s
def initialize(str)
@to_s = str
end
end
s = C.new("hello")
puts s # hello

David
···
--
David A. Black
dblack@wobblini.net
Ah.
I would put it in the pointfuscated group.
James
···
On Thu, 24 Feb 2005 23:37:26 +0900, David A. Black <dblack@wobblini.net> wrote:
Hi --
This probably lies somewhere between obfuscated and pointless, but I
thought it was a fun example of Ruby's nimbleness:
class C
attr_reader :to_s
def initialize(str)
@to_s = str
end
end
s = C.new("hello")
puts s # hello

Robert
(Robert)
3
"David A. Black" <dblack@wobblini.net> schrieb im Newsbeitrag
news:Pine.LNX.4.61.0502240635380.25193@wobblini...
Hi --
This probably lies somewhere between obfuscated and pointless,
LOL - I have to make a note for this localization. 
but I
thought it was a fun example of Ruby's nimbleness:
class C
attr_reader :to_s
def initialize(str)
@to_s = str
end
end
s = C.new("hello")
puts s # hello

With the added
class C
alias :to_str :to_s
end
You can even do this:
/ll/ =~ s
=> 2
:-))
robert
Ptkwt
4
In article <Pine.LNX.4.61.0502240635380.25193@wobblini>,
···
David A. Black <dblack@wobblini.net> wrote:
Hi --
This probably lies somewhere between obfuscated and pointless, but I
thought it was a fun example of Ruby's nimbleness:
class C
attr_reader :to_s
def initialize(str)
@to_s = str
end
end
s = C.new("hello")
puts s # hello

Cool.
I read the subject of your post and thought that perhaps you were going to
ask if someone else would organize RubyConf this year 
Phil