From: Rick DeNatale Date: 2010-05-29T03:04:22+09:00 Subject: Re: Hash : TypeError: can't convert Symbol into Integer 2010/5/28 Une Bévue : > here is my code : > > h = Hash.new  (same error with h = {} ) > h[:path] = "/Users/yt/lib/ruby-i386/" > puts "# -> h[:path] = #{h[:path]}" > info_for(h[:path]).each {|k,v| puts "# -> #{k} (#{k.class}) => #{v} > (#{v.class})"} You are calling info_for with h[:path] which is"/Users/yt/lib/ruby-i386/" > def info_for(h) >  raise ArgumentError, "The file '#{h[:path]}' does not exist!" unless > File.exist?(h[:path]) > > the line which raises this TypeError: can't convert Symbol into Integer > is the first of info_for(h) that's to say : > raise ArgumentError, "The file '#{h[:path]}' does not exist!" unless > File.exist?(h[:path]) This then tries to evaluate: "/Users/yt/lib/ruby-i386/"[:path] > clearly i'm in the dark )) J'espère qu'il est peu un plus lumineux maintenant. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale