Problems using a string as an option

Hello Group,

I’ve tried various ways to solve my problem with no luck.
I have a loop that creates a string based upon a database

@markerstring << “#{spot.id} => @markers[#{spot.id}]”

this creates the correct string
I am then using the ym4r library(http://thepochisuperstarmegashow.com/
ProjectsDoc/ym4r_gm-doc/) to create a markergroup with a function
that creates some javascript.

Like so,

@map.overlay_global_init(GMakerGroup.new(true,@markerstring),“MyGroup”)

^^^^ This doesn’t work but the following does:

@map.overlay_global_init(GMakerGroup.new(true, 1 => @markers[1],2 =>
@markers[2]),“MyGroup”)

so I’m assuming that it is passing “@markerstring” rather than the
contents of the VAR @markersting as an option, thus the operation
fails…

Any ideas what I’m doing wrong? Or how I can dynamically compile a
options string???

Thanks!

On Nov 28, 2007 5:25 PM, Jay [email protected] wrote:

@map.overlay_global_init(GMakerGroup.new(true,@markerstring),“MyGroup”)

I’m not sure what you’re trying to do exactly but usually you pass a
hash to new(), something like:

GMakerGroup.new( :foo => true, :bar => @markerstring )


Greg D.
http://destiney.com/

Basically I’m wondering why

@string = “:foo => true, :bar =>@markerstring”

GMakerGroup.new(@string)

is not equal to

GMakerGroup.new( :foo => true, :bar => @markerstring )

that is all, why is my string being interpreted as “@string” rather
than its contents???

On 29 Nov 2007, at 19:18, Jay wrote:

that is all, why is my string being interpreted as “@string” rather
than its contents???

Strings aren’t hashes. There is no “interpretation” going on when you
pass @string to GMakerGroup, it’s just a string
There’s no reason why those 2 things should be equivalent.

Fred