B
Bernard Lambeau
[Note: parts of this message were removed to make it a legal post.]
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: (e-mail address removed)
Mobile: +32 477 24 58 61
Blog: http://revision-zero.org/
Code: http://github.com/blambeau/
Follow: http://twitter.com/blambeau/
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: (e-mail address removed)
Mobile: +32 477 24 58 61
Blog: http://revision-zero.org/
Code: http://github.com/blambeau/
Follow: http://twitter.com/blambeau/