These are chat archives for opal/opal

Mar 2019
Mar 06 15:40
This may be a newbie code question but how do you convert a js object to a opal hash? I have a section of code I'm writing in opal for business logic and I want to call it from js
Jan Biedermann
Mar 06 16:04
Mar 06 16:27
{a: 1} this javascript object?
doesn't seem to work
I'm experimenting with importing opal into a node project
I compile it with the opal cmd line compiler and then am exporting the methods i want available from the exported code like
return (def hi(args)
  args = args
  # puts args['hi'], args['there']
I can then access this from plain JS like ExportedOpal().$hi({hi: 'there'})
I want to figure out how to convert js objects into hashes, i tried the but doesn't seem to work
Jan Biedermann
Mar 06 16:40
Opal.Hash.$new({a: 1})['$[]']('a‘) works for me, prints 1
oh, maybe you have to:`args`)
to make sure you get tha bare js version of args
Guillaume Grossetie
Mar 06 17:40
Hey @janbiedermann I'm trying to package the Opal runtime as an ES6 modules (strict mode)
Jan Biedermann
Mar 06 18:02
supercool :)
Mar 06 19:35
And how do you convert hash back to object? .to_n doesn't work
Elia Schito
Mar 06 19:36
Leon you might need to require “native”
G. Gibson
Mar 06 19:37
@illogikal : I was thinking $jQuery.ParseJSONFunction(#{AHash.to_json})
in tick quotes
Jared White
Mar 06 23:51
Hi everybody! Long (very long) time no talk! I'm checking in because my domain "" is expiring at the end of the month, and I'd be happy to transfer it over to someone in the Opal community if that's of interest. Otherwise I'll let it lapse. The site/newsletter's been stagnant or offline for quite some time…