From: John W Higgins Date: 2009-10-21T11:42:43+09:00 Subject: Re: C extension: How to create a Hash entry with Symbol key ? --0016e68f9f78c3d21a047668ee4e Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Tue, Oct 20, 2009 at 4:54 PM, I=F1aki Baz Castillo wrote= : > Hi, I do know how to create a hash from C in wich keys and values are > strings: > > VALUE hash =3D rb_hash_new(); > rb_hash_aset(hash, rb_str_new("mykey",5), rb_str_new2(myvalue)); > > But now I want to create Hash entries with Symbol keys so the resulting > Hash > would look like: > { :mykey =3D> "lalala" } > > This should do it..... rb_hash_aset(hash, ID2SYM(rb_intern("mykey")), rb_str_new2(myvalue)); John --0016e68f9f78c3d21a047668ee4e--