Class: Client::Variable
- Inherits:
-
Object
- Object
- Client::Variable
- Defined in:
- lib/client_variable.rb
Direct Known Subclasses
Class Method Summary collapse
- .clear ⇒ Object
- .get_variable(name) ⇒ Object
- .global ⇒ Object
- .method_missing(method, *args, &block) ⇒ Object
- .push(data = {}) ⇒ Object
- .set_variable(name, value) ⇒ Object
- .values ⇒ Object
Class Method Details
.get_variable(name) ⇒ Object
11 12 13 |
# File 'lib/client_variable.rb', line 11 def get_variable(name) Request.values[name] end |
.global ⇒ Object
7 8 9 |
# File 'lib/client_variable.rb', line 7 def global Global end |
.method_missing(method, *args, &block) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/client_variable.rb', line 35 def method_missing(method, *args, &block) if ( method.to_s =~ /=$/ ) if public_methods? method raise "You can't use Gon public methods for storing data" end set_variable(method.to_s.delete('='), args[0]) else get_variable(method.to_s) end end |
.push(data = {}) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/client_variable.rb', line 27 def push(data = {}) raise "Object must have each_pair method" unless data.respond_to? :each_pair data.each_pair do |name, value| set_variable(name.to_s, value) end end |