Sha256: c38629ffdcb0d016fd20187abaca83827182c1cfe5d331ff4eee2e1be7d33b2d
Contents?: true
Size: 845 Bytes
Versions: 1
Compression:
Stored size: 845 Bytes
Contents
require 'action_view' require 'action_controller' require 'gon/helpers' module Gon def self.all_variables @request_env[:gon] end def self.clear @request_env[:gon] = {} end def self.request_env=(request_env) @request_env = request_env end def self.request_env if defined?(@request_env) return @request_env end end def self.method_missing(m, *args, &block) @request_env[:gon] ||= {} if ( m.to_s =~ /=$/ ) if self.public_methods.include? m.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]) else get_variable(m.to_s) end end def self.get_variable(name) @request_env[:gon][name] end def self.set_variable(name, value) @request_env[:gon][name] = value end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gon-1.1.3 | lib/gon.rb |