Created
April 30, 2018 18:44
-
-
Save gswallow/601ba971409b08e8b46447fe3ffd3019 to your computer and use it in GitHub Desktop.
inject
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
order = [] | |
lifecycle_envs.each do |e| | |
if e['prior'].nil? | |
order.unshift(e['name']) | |
elsif order.include?(e['prior']['name']) | |
order.insert(order.index(e['prior']['name']) + 1, e['name']) | |
else | |
order.push(e['name']) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment