can't convert String into Integer

U

Une bévue

i have a hash like that :

@label_list={}

with only one key for the time being :

@label_list["BookmarksBar"]=[]

then, the value is an Array populated like that :

@label_list["BookmarksBar"] << folder.attributes["label"].gsub(/"(.*)"/,
'\1')

then, i want to use this hash-value by :

if !@label_list["BookmarksBar"].include?(label_) # <= line 143


this works a number of times (it's within an each loop) until label_ =
"files" where i get :

/Users/yvon/work/RubyCocoa/BookmarksMerge/build/Development/BookmarksMer
ge.app/Contents/Resources/Controller.rb:143:in `NSApplicationMain':
NSApplicationMain - RBException_TypeError - can't convert String into
Integer (OSX::OCException)


label_ are always strings...

i don't understand ))
 
D

David Vallner

D=C5=88a Pondelok 20 Febru=C3=A1r 2006 18:43 Une b=C3=A9vue nap=C3=ADsal:
i have a hash like that :

@label_list=3D{}

with only one key for the time being :

@label_list["BookmarksBar"]=3D[]

then, the value is an Array populated like that :

@label_list["BookmarksBar"] << folder.attributes["label"].gsub(/"(.*)"/,
'\1')

then, i want to use this hash-value by :

if !@label_list["BookmarksBar"].include?(label_) # <=3D line 143


this works a number of times (it's within an each loop) until label_ =3D
"files" where i get :

/Users/yvon/work/RubyCocoa/BookmarksMerge/build/Development/BookmarksMer
ge.app/Contents/Resources/Controller.rb:143:in `NSApplicationMain':
NSApplicationMain - RBException_TypeError - can't convert String into
Integer (OSX::OCException)


label_ are always strings...

i don't understand ))

I can't reproduce this. Can you make a simple full code example where this=
=20
happens? Otherwise, I'd blame a bug someplace else and a mysterious=20
off-by-one line count mishap.

David Vallner
 
R

Robert Klemme

Une bévue said:
i have a hash like that :

@label_list={}

with only one key for the time being :

@label_list["BookmarksBar"]=[]

then, the value is an Array populated like that :

@label_list["BookmarksBar"] <<
folder.attributes["label"].gsub(/"(.*)"/, '\1')

This gsub is pretty useless as it will replace the string by itself. What
are you trying to do here?
then, i want to use this hash-value by :

if !@label_list["BookmarksBar"].include?(label_) # <= line 143


this works a number of times (it's within an each loop) until label_ =
"files" where i get :

/Users/yvon/work/RubyCocoa/BookmarksMerge/build/Development/BookmarksMer
ge.app/Contents/Resources/Controller.rb:143:in `NSApplicationMain':
NSApplicationMain - RBException_TypeError - can't convert String into
Integer (OSX::OCException)


label_ are always strings...

i don't understand ))

Me too. What libraries are you using? If @label_list is a normal Hash and
the entry is a normal Array, as your code snippets suggest, then I can't see
how this error can occur. Seems we need more information...

Kind regards

robert
 
D

david

Quoting Robert Klemme said:
folder.attributes["label"].gsub(/"(.*)"/, '\1')
=20
This gsub is pretty useless as it will replace the string by itself. W= hat=20
are you trying to do here?
=20

It strips the double quotes.

David Vallner
 
U

Une bévue

Robert Klemme said:
Blind I am. Gosh! Thanks for clearing the fog from my brain.

;-)

in fact i want to synchronize safari and firfox bookmaks on the safari
side some of them are written :

"Swing"

the equivalent on firefox being written :

Swing

then, i wipe out the difference;;;
 
U

Une bévue

David Vallner said:
Otherwise, I'd blame a bug someplace else and a mysterious
off-by-one line count mishap.

Right their was a big bugg of roughly 80 Kg :
the guy betwwen my chair and the computer ;-)

in fact the error wasn't directly coming from the line given by ruby ))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top