From: Bernard Lambeau Date: 2011-06-20T21:40:14+09:00 Subject: What about Object#to_ruby ? --0023543333f24d1f0504a6240976 Content-Type: text/plain; charset=ISO-8859-1 Hi! It's not the first time that I need a to_ruby method which would guarantee the following invariant: Kernel.eval(foo.to_ruby) == foo It actually works when using inspect with most basic objects (Integer, String, True & FalseClass, etc.), without actually being the specification of inspect. I admit that such a feature probably only makes sense for classes that actually capture datatypes, whose instances are then true values. Does anyone know a gem that provides such a feature? To your knowledge, would to_ruby be a conflicting name with existing gems in the ecosystem or future plans for ruby itself? Just in case you ask yourself whether this feature is needed, have a look at rubygems itself: https://github.com/rubygems/rubygems/blob/master/lib/rubygems/specification.rb#L1899-1915 Thanks for any suggestion, Bernard -- PhD Student, Computer Science Department, EPL/INGI, UCLouvain, Belgium Mail: blambeau@gmail.com Mobile: +32 477 24 58 61 Blog: http://revision-zero.org/ Code: http://github.com/blambeau/ Follow: http://twitter.com/blambeau/ --0023543333f24d1f0504a6240976--