Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

An option to return hashes instead of structs #40

Open
jgonera opened this issue Aug 6, 2011 · 2 comments
Open

An option to return hashes instead of structs #40

jgonera opened this issue Aug 6, 2011 · 2 comments

Comments

@jgonera
Copy link

jgonera commented Aug 6, 2011

What is the reason behind converting all the data to structs? I actually find hashes better because I can encode them back to JSON easily. How about an option for API calls (or some general configuration setting) which would disable the hash to struct conversion?

@victorbstan
Copy link

I'm using this patch:

# used to transform Structs from Dropbox to JSON
class Struct
  def to_map
    map = Hash.new
    self.members.each { |m| map[m] = self[m] }
    map
  end

  def to_json(*a)
    to_map.to_json(*a)
  end
end

@jgonera
Copy link
Author

jgonera commented Sep 27, 2011

I'm doing something similar but still, it bothers me that there is a hash -> struct -> hash conversion.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants