@@ -17,6 +17,10 @@ def all_variables
1717 @request_env [ :gon ]
1818 end
1919
20+ def all_variables = ( values )
21+ raise "You can't use Gon public methods for storing data"
22+ end
23+
2024 def clear
2125 @request_env [ :gon ] = { }
2226 end
@@ -37,7 +41,7 @@ def request
3741 end
3842
3943 def request = ( request_id )
40- @request_id = request_id
44+ @request_id = request_id
4145 end
4246
4347 def method_missing ( m , *args , &block )
@@ -61,10 +65,10 @@ def set_variable(name, value)
6165
6266 def rabl ( view_path , options = { } )
6367 if !defined? ( Gon ::Rabl )
64- raise NoMethodError . new ( 'You should define Rabl in your Gemfile' )
68+ raise NoMethodError . new ( 'You should define Rabl in your Gemfile' )
6569 end
66- rabl_data = Gon ::Rabl . parse_rabl ( view_path , options [ :controller ] ||
67- @request_env [ 'action_controller.instance' ] ||
70+ rabl_data = Gon ::Rabl . parse_rabl ( view_path , options [ :controller ] ||
71+ @request_env [ 'action_controller.instance' ] ||
6872 @request_env [ 'action_controller.rescue.response' ] .
6973 instance_variable_get ( '@template' ) .
7074 instance_variable_get ( '@controller' ) )
@@ -81,13 +85,13 @@ def rabl(view_path, options = {})
8185
8286 def jbuilder ( view_path , options = { } )
8387 if RUBY_VERSION !~ /9/
84- raise NoMethodError . new ( 'You can use Jbuilder support only in 1.9+' )
88+ raise NoMethodError . new ( 'You can use Jbuilder support only in 1.9+' )
8589 elsif !defined? ( Gon ::Jbuilder )
86- raise NoMethodError . new ( 'You should define Jbuilder in your Gemfile' )
90+ raise NoMethodError . new ( 'You should define Jbuilder in your Gemfile' )
8791 end
8892
89- jbuilder_data = Gon ::Jbuilder . parse_jbuilder ( view_path , options [ :controller ] ||
90- @request_env [ 'action_controller.instance' ] ||
93+ jbuilder_data = Gon ::Jbuilder . parse_jbuilder ( view_path , options [ :controller ] ||
94+ @request_env [ 'action_controller.instance' ] ||
9195 @request_env [ 'action_controller.rescue.response' ] .
9296 instance_variable_get ( '@template' ) .
9397 instance_variable_get ( '@controller' ) )
0 commit comments