Skip to content

Dictionary support in Ruby #3

@hems

Description

@hems

We haven't exposed dictionaries to Ruby and we don't have a jcom.pack! equivalent in Ruby.

Since the dictionaries being passed to move data in the control graph are essentially implemented internally as hashes, it would make sense to somehow bridge them with Ruby's hashes. Maybe something like:

%my_dictionary = {:schema => attribute, :name => ramptime, :value => {:schema => number, :value => 1000}}%

Jesse responds to that suggestion with the following:

This seems a little complicated. Yes, it makes it clear by spelling out the schema types for the dictionary and the value, but accessing it would be something like

my_dictionary.name              <=  I like this one
my_dictionary.value.value           <= Awkward!

which is a little awkward.

I think I would want to access it like

my_dictionary.name
my_dictionary.value

There may also be a need for multiple name/value pairs or multiple values for a certain name (kind of like specifying ramp destination and duration segments to a line object.

my_dictionary.items.each do |item|
    item.name
    item.value
    item.schema
end

my_dictionary = { :schema => attribute, :items => [ :name => ramptime, :schema => number, :value => 1000 ] }

or

my_dictionary.value.each do |value|
    post value
end

my_dictionary = {:dictionary_schema => attribute, :name => ramp, :schema => number, :value => [ 1000, 100, 2500, 300 ] }

I guess it boils down to this. What kinds of data are going to be passed in these dictionaries? and How much meta-data are we trying to pass along with it? e.g. :schema information - for the dictionary and the values.

Just a thought, would it be beneficial to be able to query an object to see what kind of dictionary it is expecting? Or will it suffice to just have a standard configuration - e.g. the convention over configuration ideal.

see more on the original redmine issue http://redmine.jamoma.org/issues/681

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions