These are chat archives for opal/opal

17th
Aug 2018
dummy
@dummy27680406_twitter
Aug 17 2018 09:32
that looks cool, will give it a try :) thank you
dummy
@dummy27680406_twitter
Aug 17 2018 11:34
this is weird
puts @klasses
DOM {
  div(id: 'results') {
    @klasses.each do |klass|
      h1 { klass.to_s }
    end
  }
}.append_to($document.body)

fails with

> [Foo_Test, Bar_Test]
> uncaught exception: each: undefined method `each' for nil

How can I access the @klasses variable?

Elia Schito
@elia
Aug 17 2018 13:32
You need to put klasses = @klasses in a local var outside of the DOM block and then you can use it inside
@dummy27680406_twitter ^
dummy
@dummy27680406_twitter
Aug 17 2018 13:32
yeeeey :) thx