These are chat archives for opal/opal

Oct 2017
Frederic ZINGG
Oct 03 2017 12:52


When i run this code:

<script type="text/ruby">

    Document.ready? do

       @obj = `[{
        "name": "Lunr",
          "text": "Like Solr, but much smaller, and not as bright."
        }, {
          "name": "React",
          "text": "A JavaScript library for building user interfaces."
        }, {
          "name": "Lodash",
          "text": "A modern JavaScript utility library delivering modularity, performance & extras."

       puts @obj



I got the error:

Uncaught TypeError: item.$__id__ is not a function

How to access my Javascript object elements ?

Elia Schito
Oct 03 2017 12:56
@fzingg you can either use the console: require 'console'; $console.log @obj
or import the objects as Hash instances: require 'native'; puts{|element|}
Frederic ZINGG
Oct 03 2017 13:25
@elia Tx, the second one works well.
rubyobj ={|element|}
puts rubyobj[0][:name]