Why would #each_with_object and #inject switch the order of block parameters?
问题 #each_with_object and #inject can both be used to build a hash. For example: matrix = [['foo', 'bar'], ['cat', 'dog']] some_hash = matrix.inject({}) do |memo, arr| memo[arr[0]] = arr memo # no implicit conversion of String into Integer (TypeError) if commented out end p some_hash # {"foo"=>["foo", "bar"], "cat"=>["cat", "dog"]} another_hash = matrix.each_with_object({}) do |arr, memo| memo[arr[0]] = arr end p another_hash # {"foo"=>["foo", "bar"], "cat"=>["cat", "dog"]} One of the key