These are chat archives for opal/opal

11th
May 2016
John Munyi
@wolfieorama
May 11 2016 06:34
hello guys ..new here .... hoping to solve all my js problems
Martin Becker
@Thermatix
May 11 2016 07:09
@catmando there is a better way
have a single ERB file that has the following:
<%= MyGemConfig.render %>
and then have a class like this:
Martin Becker
@Thermatix
May 11 2016 07:25
class MyGemConfig
  class << self

    def set_config_class_name_to value
      @class_name = value
    end

    def add_value value
      @values||= []
      @values << value
    end


    def render
      @rendered||=
        @values.map {|value| "#{ get_class_name }.value = #{render_value(value)}" }.join("\n")
    end

    private

    def get_class_name
      @class_name || 'MyGemConfig'
    end

    def render_value value
      if  value.is_a? String
        '"value"'
      elsif value.is_a? Array
        "[#{value.map{|v|"#{render_value(v)}"}.join(',')}]"
      else value.is_a? Hash
        "{}#{value.map{|k,v|"'#{k}' => #{render_value(v)}"}.join(',')}}"
      else
        value
      end
    end
  end
end
it should re-render every time the server is booted
Martin Becker
@Thermatix
May 11 2016 07:47
btw, is there an opal-electron package?
Jamie Gaskins
@jgaskins
May 11 2016 14:26
@Thermatix This might help get you started: https://github.com/johnsusi/electron-clearwater
Martin Becker
@Thermatix
May 11 2016 16:46
AH, an example app, interesting
second question, is there a link to some documentation that properly explainsNative?
Martin Becker
@Thermatix
May 11 2016 16:52
@catmando the main point is to have it re-render every time the application is booted, ofc it's re-rendered every time the file is pulled so My suggestion would be to instead render and store an ERB fragment in memory and then some out point to that instead of an actual file.
Martin Becker
@Thermatix
May 11 2016 17:38
oh and thanks @jgaskins , it gave me a lot to think about
Zak Storer
@zacts
May 11 2016 22:56
How well does opal work for writing plugins for the atom.io text editor?
https://gist.github.com/edubkendo/9363111 <-- this is what I've found thus far
My apologies for the gist on channel, I only meant to link to it.
(I'm still getting used to Gitter)
Brady Wied
@wied03
May 11 2016 23:04
@zacts - Probably relates to the functionality that the --no-opal-exit command line flag to the opal binary controls
@zacts - FYI, we're talking about extracting a single, bootstrap friendly NPM package for opal here https://github.com/anthonny/opal-npm-wrapper/issues/11#issuecomment-214813258 - have been too busy to act on it
@zacts - re: no opal exit, I actually looked at your gist and it might be as simple as missing require 'opal'