We use this exercise to get a sense of your coding style, your judgement, and your familiarity with Ruby. There's no one right solution, so feel free to tackle the problem however you see fit.
Your task is to build a simple command-line application. This application takes a JSON array of nested objects:
[{
"views": {
"v1": { "access": true },
"v2": { "access": false },
"v3": { "access": false }
}
},
{
"views": {
"v1": { "access": false },
"v2": { "access": true },
"v3": { "access": true },
}
}]
It outputs a single object that contains a merged copy of the
permissions where in the leaf nodes, true
values should override
false
ones. For the input above, the application should output:
{
"views": {
"v1": { "access": true },
"v2": { "access": true },
"v3": { "access": true }
}
You can assume that JSON objects will only be nested 2 deep.
Before running your application, we'll unzip/clone it into a directory on a
UNIX-like system running Ruby v2 or higher, and run bundle install
if
a Gemfile is present.
We'll then read any README file present at the root of your repo. If there are instructions you'd like to include (like how to invoke your app), leave them there.
Your application will be run on a variety of inputs, which may include malformed data.
Please submit a zip file or a link to a git repository containing your application and any related files (READMEs, tests, etc).