Git Product home page Git Product logo

dish's People

Contributors

aredondo avatar erran avatar lassebunk avatar markusharmsen avatar mbiffara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dish's Issues

[question]: Any interest on pulling in some of my patches?

  • Convert camel case keys into underscore keys. (This is useful in the library I wrote, it's a matter of opinion if it's a good default though)
  • Adds support for #key_name= methods. (This modified the original has ATM)
  • Displays the keys in #methods (underscored like about, but could be changed).
  • Fixes #to_json which is useful when marshaling and unmarshaling to/from HTTP responses.
  • Use #to_h instead of #as_hash (provide an alias for compat.)

See the original file used in an API client here.

Getting a reference to an object's parent... possible?

Hey there, I'm using Dish in RubyMotion and I really love it! Thanks so much for creating this library and making it compatible with RM!

Question about getting a reference to an object's parent...

I have:

{
  id: 12,
  items: [{
    name: "test1"
  },{
    name: "test2"
  }]
}

Defined by:

class Order < Dish::Plate
  coerce :items, Item
end
class Item < Dish::Plate
end

Is there a way to get an item's parent (Order) id?

# my_item is an Item
my_item.parent # Order object
my_item.parent.id # 12

Or if not, is there perhaps a way to set a weakref to the parent when initializing the objects?

class Order < Dish::Plate
  # Something like this?
  coerce :items, ->(value) { Item.new(value, self) }
end
class Item < Dish::Plate
  def initialize(hash, parent)
    super
    @parent = WeafRef.new(parent)
  end
end

Any ideas? Thanks again for the great library!

Reason for implementing 'to_json'

Why has the Dish::Plate#to_json method been merged into 99ac61a?

It is quite complex and even contains platform specific dependencies (NSJSONSerialization). So let the user decide how he/she wants to use to_json. Any thoughts?

Furthermore it's not covered by any tests.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.