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



15
16
17
# File 'lib/gon/watch.rb', line 15

def all_variables
  @watch_variables || {}
end

.clearObject



19
20
21
# File 'lib/gon/watch.rb', line 19

def clear
  @watch_variables = {}
end

.renderObject



7
8
9
# File 'lib/gon/watch.rb', line 7

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

.render_amdObject



11
12
13
# File 'lib/gon/watch.rb', line 11

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