[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

can't convert String into Integer

pere.noel

2/20/2006 5:39:00 PM

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

--
une bévue
6 Answers

David Vallner

2/21/2006 2:46:00 AM

0

Dna Pondelok 20 Február 2006 18:43 Une bévue napísal:
> 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 ))

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

David Vallner


Robert Klemme

2/21/2006 9:50:00 AM

0

"Une bévue" <pere.noel@laponie.com.invalid> wrote:
> 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

David Vallner

2/21/2006 5:00:00 PM

0

Quoting Robert Klemme <bob.news@gmx.net>:
> > 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?
>

It strips the double quotes.

David Vallner


Robert Klemme

2/21/2006 5:54:00 PM

0


<david@vallner.net> schrieb im Newsbeitrag
news:1140541177.43fb46f95fa5a@mail.atlantis.sk...
Quoting Robert Klemme <bob.news@gmx.net>:
> > 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?

> It strips the double quotes.

Blind I am. Gosh! Thanks for clearing the fog from my brain.

robert

pere.noel

2/21/2006 6:47:00 PM

0

Robert Klemme <bob.news@gmx.net> wrote:

>
> 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;;;
--
une bévue

pere.noel

2/21/2006 6:47:00 PM

0

David Vallner <david@vallner.net> wrote:

> 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 ))
--
une bévue