lib/gon/sinatra/store.rb in gon-sinatra-0.1.1 vs lib/gon/sinatra/store.rb in gon-sinatra-0.1.2

- old
+ new

@@ -1,6 +1,5 @@ - module Gon module Sinatra class Store attr_accessor :request @@ -14,22 +13,22 @@ def clear @env.clear end - def method_missing(m, *args, &block) - if ( m.to_s =~ /=$/ ) - if public_methods.include? m.to_s[0..-2].to_sym + def method_missing(method, *args, &block) + if ( method.to_s =~ /=$/ ) + if public_methods.include? method.to_s[0..-2].to_sym raise "You can't use Gon public methods for storing data" end - set_variable(m.to_s.delete('='), args[0]) + set_variable(method.to_s.delete('='), args[0]) else - get_variable(m.to_s) + get_variable(method.to_s) end end def get_variable(name) - @env[name] + @env && @env[name] end alias :get :get_variable def set_variable(name, value) @env[name] = value