From: =?ISO-8859-1?Q?Une_B=E9vue?= on 28 May 2010 13:42 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})"} with : def info_for(h) raise ArgumentError, "The file '#{h[:path]}' does not exist!" unless File.exist?(h[:path]) a = MacTypes::Alias.path(h[:path]) ho = OSAX::ScriptingAddition.new('StandardAdditions', StandardAdditions).info_for(a.desc) h = h.merge(ho) h = original_item(h) if h[:alias] return h end 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]) clearly i'm in the dark )) -- � Le monde est une com�die dont les philosophes sont les spectateurs. � (Pythagore)
From: =?ISO-8859-1?Q?Une_B=E9vue?= on 28 May 2010 13:49 Une B�vue <unbewusst.sein(a)google.com.invalid> wrote: > here is my code : if i change the starting point to : h = {:path => "/Users/yt/lib/ruby-i386/"} same error at same line ))) -- � Le monde est une com�die dont les philosophes sont les spectateurs. � (Pythagore)
From: Rick DeNatale on 28 May 2010 14:04 2010/5/28 Une Bévue <unbewusst.sein(a)google.com.invalid>: > 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
From: =?ISO-8859-1?Q?Une_B=E9vue?= on 28 May 2010 14:05 Une B�vue <unbewusst.sein(a)google.com.invalid> wrote: > if i change the starting point to : > > h = {:path => "/Users/yt/lib/ruby-i386/"} > > same error at same line ))) I've found MY error, it isn't in info_for(h) but rather in the calling : truc = info_for(h[:path]) better using : truc = info_for(h) .... -- � Le monde est une com�die dont les philosophes sont les spectateurs. � (Pythagore)
From: =?ISO-8859-1?Q?Une_B=E9vue?= on 28 May 2010 14:38 Rick DeNatale <rick.denatale(a)gmail.com> wrote: > J'esp�re qu'il est peu un plus lumineux maintenant. Merci, j'avais vu ma connerie entre-temps ))) -- � Le monde est une com�die dont les philosophes sont les spectateurs. � (Pythagore)
|
Pages: 1 Prev: ANN: guirb 0.02: The return of fxirb Next: A complete beginners question |