Skip to content

Instantly share code, notes, and snippets.

@rjhornsby
Created September 29, 2015 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjhornsby/3966ac3ee383ed6553c5 to your computer and use it in GitHub Desktop.
Save rjhornsby/3966ac3ee383ed6553c5 to your computer and use it in GitHub Desktop.
$ ./shelter.rb
== constructing a dog ==
== constructing an animal ==
Pets rendered as JSON:
[{"json_class":"Dog","data":{"has_fur":true,"color":"black","name":"fido","bark":"loud"}}]
=== Recovering lost pets from the evil JSON Deville ===
Calling Dog::json_create
{"json_class"=>"Dog",
"data"=>{"has_fur"=>true, "color"=>"black", "name"=>"fido", "bark"=>"loud"}}
== constructing a dog ==
== constructing an animal ==
=== Here are your lost pets ===
[#<Dog:0x007fae530fe430 @bark="loud", @color=nil, @has_fur="loud", @name=nil>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment