Created
July 31, 2015 15:00
-
-
Save blake41/ad2be9eb6e730b3e19ba to your computer and use it in GitHub Desktop.
This file contains 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 reformat_languages(languages) | |
result = {} | |
languages.each_pair do |style, values| | |
# style like :oo | |
# values like { | |
# :javascript => { | |
# :type => "interpreted" | |
# } | |
values.each_pair do |language, attributes| | |
# language is like :javascript | |
# attribute is like { | |
# :type => "interpreted" | |
# } | |
# case 1, i've never seen this language before | |
result[language] ||= {} | |
result[language][:type] = attributes[:type] | |
result[language][:style] ||= [] | |
result[language][:style] << style | |
end | |
end | |
result | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment