Hi sir Jonas (aka Jonas Hoffmann [mailto:ruby@joelh.de]):
You asked last Thursday, December 26, 2002 5:58 PM:
i have a question about Structs , in the Book ‘Ruby in a
Nutshell’ is written
=>
S = Struct::new(:foo, :bar)
s = S::new(1,2)
s => #but
i receive with my Code Ruby v1.6.8 =>
tem = Struct::new(:foo, :bar)
meinstruct = tem::new(0,8)
puts meinstruct=> #<#<Class 0lx4013ac0c>>
is this a change in a Rubyversion ? Or did i read the book wrongly ?
I have:
C:\family\ruby>ruby -v
ruby 1.7.3 (2002-11-17) [i386-mswin32]
C:\family\ruby>type a1.rb
tem = Struct::new(:foo, :bar)
meinstruct = tem::new(0,8)
p meinstruct
puts meinstruct
C:\family\ruby>r
C:\family\ruby>ruby a1.rb
#<#Class:0x278a320 foo=0, bar=8>
#<#Class:0x278a320>
C:\family\ruby>
I think code differs only on p vs puts…
mfg. Jonas Hoffmann
kind regards -botp