Ruby to JSON - how to store javascript functions

Hey guys,

I am working on a small plug-in which stores settings in a yaml file,

:before: var lastsel2;
:datatype: xml
:mtype: GET

etc., then later turning them into js with something like

params.each do |key,value|
emit "#{key}: #{value.to_json}

so far so good. My question is, what should I put in the place of ???

:some_func: ???

so that the Ruby code above spits out this:

some_func: function(id) {

I hope it’s clear :slight_smile: Obviously I’d like to store the function params
and body as well.
Is there a (semi-)standard way of doing this? I thought of
representing the js function with some custom class, storing the param
list and body as strings. Am I completely off?


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs