module Gon::ViewHelpers

Public Instance Methods

include_gon(options = {}) click to toggle source
# File lib/gon/helpers.rb, line 3
def include_gon(options = {})
  if variables_for_request_present?
    Gon::Base.render_data(options)
  elsif Gon.global.all_variables.present? || options[:init].present?
    Gon.clear
    Gon::Base.render_data(options)
  else
    ''
  end
end
include_gon_amd(options={}) click to toggle source
# File lib/gon/helpers.rb, line 14
def include_gon_amd(options={})
  Gon::Base.render_data(options.merge({amd: true}))
end

Private Instance Methods

current_gon() click to toggle source
# File lib/gon/helpers.rb, line 24
def current_gon
  RequestStore.store[:gon]
end
variables_for_request_present?() click to toggle source
# File lib/gon/helpers.rb, line 20
def variables_for_request_present?
  current_gon && current_gon.gon
end