test/navigation_test.rb
# We need to be careful not to modify the original NAV_DATA object when
# sorting.
We need to be careful not to modify the original NAV_DATA object when
sorting.
We need to be careful not to modify the original NAV_DATA object when sorting .
def sorted_nav_data(nav_data)
      nav_data = {}.merge(nav_data)
      sorted = nav_data['navigation'].map { |i| i }.sort_by { |i| i['text'] }
      nav_data['navigation'] = sorted
      nav_data
    end
def sorted_nav_data ( nav_data ) nav_data = { } . merge ( nav_data ) sorted = nav_data [ 'navigation' ] . map { | i | i } . sort_by { | i | i [ 'text' ] } nav_data [ 'navigation' ] = sorted nav_data end
We need to be careful not to modify the original NAV_DATA object when
sorting.
We need to be careful not to modify the original NAV_DATA object when sorting .
nav_data
<not_specific>