Building a Data Merger for Duplicate Keys in Ruby
This guide will show how you can combine lines of data that has duplicate value(s), without the concern of anything being overwritten.
Guide Tasks
  • Read Tutorial
  • Complete the Exercise

Summary

Build a method that cleanly merges duplicate code.

Exercise Description

Define a method that merges a set of data, but does not overwrite for duplicate keys.

Example Data

data_one = { left_field:  100, right_field: 200 }
data_two = { right_field: 254, short_stop: 300 }

Real World Usage

When working with a large collection of data, it is very helpful to know how to implement this code exercise so that you don't have to go back through and undo any data that was overwritten.

Test Cases

Code File