Creating an object from a pp string?

When I use pp on an object in rails, it prints out a nice string representation of the object. I am trying to pass objects from one server to another and I am wondering if I can just pass this string and create an object on the other server. Any libraries/functions out there that can do this? Or any other way to do this (not necessarily using pp).

Thanks!

When I use pp on an object in rails, it prints out a nice string representation of the object. I am trying to pass objects from one server to another and I am wondering if I can just pass this string and create an object on the other server. Any libraries/functions out there that can do this? Or any other way to do this (not necessarily using pp).

If you really want to go that route you might look at converting it to YAML... but I'd also suggest looking at JSON, XML, XML-RPC, REST, active resource, etc...

-philip

Philip Hallstrom wrote:

If you really want to go that route you might look at converting it to YAML... but I'd also suggest looking at JSON, XML, XML-RPC, REST, active resource, etc...

-philip

Thanks for the quick reply!

Right now I am just creating a pipe-delimited string of the object attributes. Then the other server takes that string, splits it on | and populates a new object. Really I am just wondering if there is a one liner from a library where I can do this. JSON, etc.. would be overkill, since I can easily do it with a pipe-delimited string. I might just code a utility to do this with the pp string unless someone has some code that already does this. let me know.. thanks

If you really want to go that route you might look at converting it to YAML... but I'd also suggest looking at JSON, XML, XML-RPC, REST, active resource, etc...

-philip

Thanks for the quick reply!

Right now I am just creating a pipe-delimited string of the object attributes. Then the other server takes that string, splits it on | and populates a new object. Really I am just wondering if there is a one liner from a library where I can do this. JSON, etc.. would be overkill, since I can easily do it with a pipe-delimited string. I might just code a utility to do this with the pp string unless someone has some code that already does this. let me know.. thank

http://www.ruby-doc.org/stdlib/libdoc/yaml/rdoc/classes/YAML.html#M010508 http://www.ruby-doc.org/stdlib/libdoc/yaml/rdoc/classes/YAML.html#M010509

Philip Hallstrom wrote:

Right now I am just creating a pipe-delimited string of the object attributes. Then the other server takes that string, splits it on |
and populates a new object. Really I am just wondering if there is a one liner from a library where I can do this. JSON, etc.. would be overkill, since I can easily do it with a pipe-delimited string. I might just code a utility to do this with the pp string unless someone has some code that already does this. let me know.. thank

http://www.ruby-doc.org/stdlib/libdoc/yaml/rdoc/classes/YAML.html#M010508 http://www.ruby-doc.org/stdlib/libdoc/yaml/rdoc/classes/YAML.html#M010509

Ah.. you da man. Thanks, I guess I overlooked that :wink: That does exactly what I need it to.