Added #to_json, use #method_missing, and init using JSON #1

Merged
merged 6 commits into from Jun 23, 2011

Conversation

Projects
None yet
2 participants
Contributor

purp commented Jun 22, 2011

First three commits are a trivial add; just returns @data.to_json, but it's handy if you want to serialize your data to disk (since they only give 50 calls per month for free). Also, couldn't get the specs to run due to parenthesizing errors in spec_helper, so I fixed that, too.

Next commit (70ee1b1) gets rid of the long list of attributes and the need to populate them by using #method_missing to read from @DaTa directly.

Last two commits allow you to make a new FakeNameGenerator object by passing in JSON data, like perhaps the data you might have serialized using #to_json.
Cheers!

--j

Owner

billturner commented Jun 22, 2011

@purp, thanks so much! These changes are great, and I'll take a closer look through them later today and merge them in. Any chance you could write a little bit of documentation for #to_json, and maybe an example of passing in json_data?

Contributor

purp commented Jun 22, 2011

Not sure what to doc on #to_json. What are you looking for there?

Could add an example of passing in JSON data. May take me a few days to return to this, tho.

--j

@purp purp closed this Jun 22, 2011

Contributor

purp commented Jun 22, 2011

Not sure what to doc on #to_json. What are you looking for there?

Could add an example of passing in JSON data. May take me a few days to return to this, tho.

--j

@purp purp reopened this Jun 22, 2011

Owner

billturner commented Jun 23, 2011

No worries on the to_json doc, I'll take care of that. I was just something to explain, even just a sentence on what it does. But I'll handle that, if you could work on a JSON data example when you get a chance. I'll add the to_json doc and merge this pull request. Thanks again!

@billturner billturner merged commit 4090e1d into billturner:master Jun 23, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment