Hello, Ripple users.

One thing nice about OpenStruct in Ruby - you can use the same class for
many "types" of instances. I desire the same for Ripple - something like
OpenStruct, with ability to subclass and specialize, then "embed inline",
i.e. to nest.

To illustrate, something like the following, with a custom class
(ExtProperty) analogous to a subclass of OpenStruct...

class ExtProperty
  include Ripple::NestedDocument   ## New thingy
  property :text, String
  property :source, String
  property :code, Integer
end

class Contract
  include Ripple::Document
  property :product_code, ExtProperty
  property :contract_unit, ExtProperty
  property :price_quotation_unit, ExtProperty
  property :floating_price_definition, ExtProperty
end

I can currently get part of this with the Ripple::NestedAttributes
construct, but it lacks a defined class. I would have to explicitly convert
a hash to a desired class, and vice versa. And also, the top-level class
wouldn't specify the nested class, if you were to think of the class
definition as a data model definition.

Any plans for something like what I described?

- Tom
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to