Module: Gon::Base

Defined in:
lib/gon/base.rb

Constant Summary collapse

VALID_OPTION_DEFAULTS =
{
    namespace: 'gon',
    camel_case: false,
    camel_depth: 1,
    watch: false,
    need_tag: true,
    type: false,
    cdata: true,
    global_root: 'global',
    namespace_check: false,
    amd: false,
    nonce: nil
}

Class Method Summary collapse

Class Method Details

.render_data(options = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/gon/base.rb', line 21

def render_data(options = {})
  _o = define_options(options)

  script = formatted_data(_o)
  script = Gon::Escaper.escape_unicode(script)
  script = Gon::Escaper.javascript_tag(script, _o.type, _o.cdata, _o.nonce) if _o.need_tag

  script.html_safe
end