Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #11266: ordered_hash_to_hash.diff

File ordered_hash_to_hash.diff, 1.0 kB (added by josh, 4 months ago)
  • a/activesupport/lib/active_support/ordered_options.rb

    old new  
    2626      def values 
    2727        collect { |key, value| value } 
    2828      end 
     29 
     30      def to_hash 
     31        returning({}) do |hash| 
     32          each { |array| hash[array[0]] = array[1] } 
     33        end 
     34      end 
    2935    end 
    3036  end 
    3137end 
  • a/activesupport/test/core_ext/enumerable_test.rb

    old new  
    2222    end 
    2323 
    2424    assert_equal objects.uniq.map(&:name), grouped.keys 
     25    assert({}.merge(grouped), "Could not convert ActiveSupport::OrderedHash into Hash") 
    2526  end 
    2627 
    2728  def test_sums