From: Trans Date: 2008-09-22T22:02:22+09:00 Subject: Re: Symbol#re_s On Sep 21, 9:33 pm, Stephen Celis wrote: > >> Nice idea. After some modification (using method_missing) it could be > >> used as a temporary patch on Ruby 1.8, as in Ruby 1.9 symbols are   > >> going > >> to respond to most string-like methods. > > >> also T. > > > why not simply use: > > > irb(main):002:0> :HELLO.to_s.downcase.to_sym > > => :hello > > What fun is a new version if you can't even re-factor? > >    irb(main):001:0> RUBY_VERSION >    => "1.9.0" >    irb(main):002:0> :test.capitalize >    => :Test > > A 1.8.x patch needn't rely on Facets, however: > >    class Symbol >      def method_missing(*args, &block) >        to_s.__send__(*args, &block).to_sym rescue super(*args, &block) >      end >    end True, we can do this. And it sure is convenient, but this approach is generally frowned upon because it can cover-up actual errors. But in this case, maybe it's not significant? What do others think? T.