Created
October 4, 2016 22:04
-
-
Save selmanj/92cf83cd0d0c1df3cbf6700e7612d362 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def process_collection(collection, key) | |
| process_flatten_collection(collection, key) { |x| [yield(x)] } | |
| end | |
| def process_flatten_collection(collection, key) | |
| @data[key] ||= [] | |
| @data_index[key] ||= {} | |
| collection.each do |item| | |
| yield(item).each do |uid, new_result| | |
| next if uid.nil? | |
| @data[key] << new_result | |
| @data_index.store_path(key, uid, new_result) | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment