From: Intransition Date: 2011-06-26T04:15:57+09:00 Subject: Re: Symbol#=== On Jun 25, 1:00 pm, Robert Dober wrote: > On Sat, Jun 25, 2011 at 7:57 AM, Intransition wrote: > > As: > > >    class Symbol > >      def ===(object) > >        object.respond_to?(self) > >      end > >    end > > > Then: > > >    case foo > >    when :some_method > >      foo.some_method > >    end > > > Insanity? > > No, but too invasive... > > case my_token > when :integer > when :identifier > when.... > > thanx for breaking that ;) lol. let me "fix" it for you class Symbol def ===(object) return super(object) if Symbol === object object.respond_to?(self) end end Of course, now no repsond_to? case checking for Symbols! > Furthermore I already feel that Symbol has one of the worst kludges > ever conceived cast onto itself, which is #to_proc. On the same > account I feel #=== should not be concerned with receiver's methods. #to_proc that bad?