Sort and add attributes
Sort the states and add the attribute country to each record.
Start file
State.new(:name => "Ohio") State.new(:name => "Wisconsin") State.new(:name => "Iowa") State.new(:name => "Virginia") State.new(:name => "Utah") State.new(:name => "Arizona") State.new(:name => "Mississippi") State.new(:name => "Michigan") State.new(:name => "Virgin Islands") State.new(:name => "Delaware") State.new(:name => "North Carolina") State.new(:name => "Montana") State.new(:name => "Vermont") State.new(:name => "New Jersey") State.new(:name => "Illinois") State.new(:name => "New Hampshire") State.new(:name => "Kansas") State.new(:name => "Texas") State.new(:name => "Alabama") State.new(:name => "Pennsylvania") State.new(:name => "Louisiana") State.new(:name => "Washington") State.new(:name => "North Dakota") State.new(:name => "Indiana") State.new(:name => "South Carolina") State.new(:name => "Hawaii") State.new(:name => "Idaho") State.new(:name => "Nebraska") State.new(:name => "Tennessee") State.new(:name => "Wyoming") State.new(:name => "Colorado") State.new(:name => "Rhode Island") State.new(:name => "Connecticut") State.new(:name => "Maryland") State.new(:name => "Alaska") State.new(:name => "Minnesota") State.new(:name => "West Virginia") State.new(:name => "Oklahoma") State.new(:name => "Arkansas") State.new(:name => "New Mexico") State.new(:name => "Missouri") State.new(:name => "Guam") State.new(:name => "Maine") State.new(:name => "New York") State.new(:name => "Florida") State.new(:name => "South Dakota") State.new(:name => "Georgia") State.new(:name => "Kentucky") State.new(:name => "Oregon") State.new(:name => "Nevada") State.new(:name => "Massachusetts") State.new(:name => "California")
End file
State.new(:name => "Alabama", :country => "USA") State.new(:name => "Alaska", :country => "USA") State.new(:name => "Arizona", :country => "USA") State.new(:name => "Arkansas", :country => "USA") State.new(:name => "California", :country => "USA") State.new(:name => "Colorado", :country => "USA") State.new(:name => "Connecticut", :country => "USA") State.new(:name => "Delaware", :country => "USA") State.new(:name => "Florida", :country => "USA") State.new(:name => "Georgia", :country => "USA") State.new(:name => "Guam", :country => "USA") State.new(:name => "Hawaii", :country => "USA") State.new(:name => "Idaho", :country => "USA") State.new(:name => "Illinois", :country => "USA") State.new(:name => "Indiana", :country => "USA") State.new(:name => "Iowa", :country => "USA") State.new(:name => "Kansas", :country => "USA") State.new(:name => "Kentucky", :country => "USA") State.new(:name => "Louisiana", :country => "USA") State.new(:name => "Maine", :country => "USA") State.new(:name => "Maryland", :country => "USA") State.new(:name => "Massachusetts", :country => "USA") State.new(:name => "Michigan", :country => "USA") State.new(:name => "Minnesota", :country => "USA") State.new(:name => "Mississippi", :country => "USA") State.new(:name => "Missouri", :country => "USA") State.new(:name => "Montana", :country => "USA") State.new(:name => "Nebraska", :country => "USA") State.new(:name => "Nevada", :country => "USA") State.new(:name => "New Hampshire", :country => "USA") State.new(:name => "New Jersey", :country => "USA") State.new(:name => "New Mexico", :country => "USA") State.new(:name => "New York", :country => "USA") State.new(:name => "North Carolina", :country => "USA") State.new(:name => "North Dakota", :country => "USA") State.new(:name => "Ohio", :country => "USA") State.new(:name => "Oklahoma", :country => "USA") State.new(:name => "Oregon", :country => "USA") State.new(:name => "Pennsylvania", :country => "USA") State.new(:name => "Rhode Island", :country => "USA") State.new(:name => "South Carolina", :country => "USA") State.new(:name => "South Dakota", :country => "USA") State.new(:name => "Tennessee", :country => "USA") State.new(:name => "Texas", :country => "USA") State.new(:name => "Utah", :country => "USA") State.new(:name => "Vermont", :country => "USA") State.new(:name => "Virgin Islands", :country => "USA") State.new(:name => "Virginia", :country => "USA") State.new(:name => "Washington", :country => "USA") State.new(:name => "West Virginia", :country => "USA") State.new(:name => "Wisconsin", :country => "USA") State.new(:name => "Wyoming", :country => "USA")
View Diff
1,52c1,52 < State.new(:name => "Ohio") < State.new(:name => "Wisconsin") < State.new(:name => "Iowa") < State.new(:name => "Virginia") < State.new(:name => "Utah") < State.new(:name => "Arizona") < State.new(:name => "Mississippi") < State.new(:name => "Michigan") < State.new(:name => "Virgin Islands") < State.new(:name => "Delaware") < State.new(:name => "North Carolina") < State.new(:name => "Montana") < State.new(:name => "Vermont") < State.new(:name => "New Jersey") < State.new(:name => "Illinois") < State.new(:name => "New Hampshire") < State.new(:name => "Kansas") < State.new(:name => "Texas") < State.new(:name => "Alabama") < State.new(:name => "Pennsylvania") < State.new(:name => "Louisiana") < State.new(:name => "Washington") < State.new(:name => "North Dakota") < State.new(:name => "Indiana") < State.new(:name => "South Carolina") < State.new(:name => "Hawaii") < State.new(:name => "Idaho") < State.new(:name => "Nebraska") < State.new(:name => "Tennessee") < State.new(:name => "Wyoming") < State.new(:name => "Colorado") < State.new(:name => "Rhode Island") < State.new(:name => "Connecticut") < State.new(:name => "Maryland") < State.new(:name => "Alaska") < State.new(:name => "Minnesota") < State.new(:name => "West Virginia") < State.new(:name => "Oklahoma") < State.new(:name => "Arkansas") < State.new(:name => "New Mexico") < State.new(:name => "Missouri") < State.new(:name => "Guam") < State.new(:name => "Maine") < State.new(:name => "New York") < State.new(:name => "Florida") < State.new(:name => "South Dakota") < State.new(:name => "Georgia") < State.new(:name => "Kentucky") < State.new(:name => "Oregon") < State.new(:name => "Nevada") < State.new(:name => "Massachusetts") < State.new(:name => "California") --- > State.new(:name => "Alabama", :country => "USA") > State.new(:name => "Alaska", :country => "USA") > State.new(:name => "Arizona", :country => "USA") > State.new(:name => "Arkansas", :country => "USA") > State.new(:name => "California", :country => "USA") > State.new(:name => "Colorado", :country => "USA") > State.new(:name => "Connecticut", :country => "USA") > State.new(:name => "Delaware", :country => "USA") > State.new(:name => "Florida", :country => "USA") > State.new(:name => "Georgia", :country => "USA") > State.new(:name => "Guam", :country => "USA") > State.new(:name => "Hawaii", :country => "USA") > State.new(:name => "Idaho", :country => "USA") > State.new(:name => "Illinois", :country => "USA") > State.new(:name => "Indiana", :country => "USA") > State.new(:name => "Iowa", :country => "USA") > State.new(:name => "Kansas", :country => "USA") > State.new(:name => "Kentucky", :country => "USA") > State.new(:name => "Louisiana", :country => "USA") > State.new(:name => "Maine", :country => "USA") > State.new(:name => "Maryland", :country => "USA") > State.new(:name => "Massachusetts", :country => "USA") > State.new(:name => "Michigan", :country => "USA") > State.new(:name => "Minnesota", :country => "USA") > State.new(:name => "Mississippi", :country => "USA") > State.new(:name => "Missouri", :country => "USA") > State.new(:name => "Montana", :country => "USA") > State.new(:name => "Nebraska", :country => "USA") > State.new(:name => "Nevada", :country => "USA") > State.new(:name => "New Hampshire", :country => "USA") > State.new(:name => "New Jersey", :country => "USA") > State.new(:name => "New Mexico", :country => "USA") > State.new(:name => "New York", :country => "USA") > State.new(:name => "North Carolina", :country => "USA") > State.new(:name => "North Dakota", :country => "USA") > State.new(:name => "Ohio", :country => "USA") > State.new(:name => "Oklahoma", :country => "USA") > State.new(:name => "Oregon", :country => "USA") > State.new(:name => "Pennsylvania", :country => "USA") > State.new(:name => "Rhode Island", :country => "USA") > State.new(:name => "South Carolina", :country => "USA") > State.new(:name => "South Dakota", :country => "USA") > State.new(:name => "Tennessee", :country => "USA") > State.new(:name => "Texas", :country => "USA") > State.new(:name => "Utah", :country => "USA") > State.new(:name => "Vermont", :country => "USA") > State.new(:name => "Virgin Islands", :country => "USA") > State.new(:name => "Virginia", :country => "USA") > State.new(:name => "Washington", :country => "USA") > State.new(:name => "West Virginia", :country => "USA") > State.new(:name => "Wisconsin", :country => "USA") > State.new(:name => "Wyoming", :country => "USA")
Solutions by @andreyugolnik:
Unlock 1 remaining solutions by signing in and submitting your own entry