Hash : TypeError: can't convert Symbol into Integer

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)

if i change the starting point to :

h = {:path => "/Users/yt/lib/ruby-i386/"}

same error at same line )))

···

Une Bévue <unbewusst.sein@google.com.invalid> wrote:

here is my code :

--
« Le monde est une comédie dont les philosophes sont
   les spectateurs. »
   (Pythagore)

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.

···

2010/5/28 Une Bévue <unbewusst.sein@google.com.invalid>:

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: rubyredrick (Rick DeNatale) · GitHub
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

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)
...

···

Une Bévue <unbewusst.sein@google.com.invalid> wrote:

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)

Merci, j'avais vu ma connerie entre-temps )))

···

Rick DeNatale <rick.denatale@gmail.com> wrote:

J'espère qu'il est peu un plus lumineux maintenant.

--
« Le monde est une comédie dont les philosophes sont
   les spectateurs. »
   (Pythagore)