Forum: Ruby 1.8.4 Struct bug

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
992fe8c19bbbc27f2b562a9f96efc03d?d=identicon&s=25 Jamis Buck (Guest)
on 2005-12-24 20:48
(Received via mailing list)
Found the following while making sure Net::SSH works with 1.8.4:

   irb(main):001:0> Struct.new(:valid?).new.valid?
   NoMethodError: undefined method `valid?' for #<struct #<Class:
0x535994> :valid?=nil>
         from (irb):1

This worked in 1.8.2, at least. Is this an intentional change? (This
only bites me in the unit tests for Net::SSH, and I can easily work
around it, just wanted to make sure problem this was known.)

- Jamis
733436f59b64e31c1dd78fc0d29f3cdb?d=identicon&s=25 Gyoung-Yoon Noh (Guest)
on 2005-12-24 21:33
(Received via mailing list)
On 12/25/05, Jamis Buck <jamis@37signals.com> wrote:
>
> - Jamis
>

Hi,

FWIW, it seems to be broken since 1.8.3.

$ ruby -ve 'Struct.new(:valid?).new.valid?'
ruby 1.8.3 (2005-09-21) [x86_64-linux]
-e:1: undefined method `valid?' for #<struct #<Class:0x2aaaab3e8160>
:"valid?"=nil> (NoMethodError)

I couldn't find any mention about this behavior both in [1.8.3
changes][1]
and [1.8.4 changes][2].

[1]: http://www.ruby-lang.org/ja/man/?cmd=view;name=rub...
[2]: http://www.ruby-lang.org/ja/man/?cmd=view;name=rub...
This topic is locked and can not be replied to.