Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple input properties #19

Open
iainbeeston opened this issue Sep 12, 2016 · 1 comment
Open

Multiple input properties #19

iainbeeston opened this issue Sep 12, 2016 · 1 comment

Comments

@iainbeeston
Copy link
Contributor

I often find I have to use multiple input properties to get the value for aa single output property. Right now you can do this, but you have to use before filters, like this:

before_normalize do |input, output|
  input['ab'] ||= input['a'] + input['b']
  input
end

That feels inelegant. What if you could define mappings with multiple "from" properties, like this:

map from('/a', '/b'), to('ab') { |a, b| a + b }

Is that something that would be worth adding? I'm happy to put some work into a PR for that if you like the idea

@dmitry
Copy link

dmitry commented Nov 12, 2016

@iainbeeston there are no way to denormalize in case of to('ab') { |a, b| a + b }, as the resulting value should have at least one of the values a or b to subsctract one from another (as in the example).

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

No branches or pull requests

2 participants