Skip to content

Commit 57e5f36

Browse files
committed
Doing watch
1 parent f328251 commit 57e5f36

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lib/gon/watch.rb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ class Gon
22
class Watch
33
class << self
44

5-
def method_missing(method, *args, &block)
6-
@return = return_variable?(method)
7-
Gon.send method, *args, &block
5+
def all_variables
6+
@watch_variables || {}
87
end
98

109
def clear
11-
@return = false
10+
@watch_variables = {}
1211
end
1312

1413
def need_return?
@@ -23,7 +22,15 @@ def return_variable(value)
2322

2423
private
2524

25+
def method_missing(method, *args, &block)
26+
if return_variable?(method)
27+
Gon.send method, *args, &block
28+
end
29+
end
30+
2631
def return_variable?(variable)
32+
return false if variable !~ /=$/
33+
2734
controller = Gon::Base.get_controller
2835
params = controller.params
2936
variable = variable.to_s.gsub('=', '')

0 commit comments

Comments
 (0)