Class: Gon::Watch

Inherits:
Gon
  • Object
show all
Defined in:
lib/gon/watch.rb

Constant Summary collapse

JS_FUNCTION =
File.read(File.expand_path('../../../js/watch.js', __FILE__))

Constants inherited from Gon

VERSION

Class Method Summary collapse

Methods inherited from Gon

get_variable, global, inspect, jbuilder, merge_variable, method_missing, push, rabl, watch

Class Method Details

.all_variablesObject



17
18
19
# File 'lib/gon/watch.rb', line 17

def all_variables
  @watch_variables || {}
end

.clearObject



21
22
23
# File 'lib/gon/watch.rb', line 21

def clear
  @watch_variables = {}
end

.renderObject



9
10
11
# File 'lib/gon/watch.rb', line 9

def render
  JS_FUNCTION + "window.gon.watchedVariables=#{Gon::JsonDumper.dump all_variables};"
end

.render_amdObject



13
14
15
# File 'lib/gon/watch.rb', line 13

def render_amd
  JS_FUNCTION + "gon.watchedVariables=#{Gon::JsonDumper.dump all_variables};"
end