Class: GwtRpc::Client
- Inherits:
-
Object
- Object
- GwtRpc::Client
- Defined in:
- lib/gwt_rpc/client.rb
Class Method Summary collapse
- .add_procedure(name, options, &block) ⇒ Object
- .domain(domain = nil) ⇒ Object
- .gwt_permutation(permutation = nil) ⇒ Object
- .inherited(subclass) ⇒ Object
- .java_class_to_ruby(klass) ⇒ Object
- .js_url(js_url = nil) ⇒ Object
- .map_classes(mapping) ⇒ Object
- .num_attempts(num_attempts = nil) ⇒ Object
- .procedures ⇒ Object
- .ruby_class_to_java(klass) ⇒ Object
- .timeout(timeout = nil) ⇒ Object
Class Method Details
.add_procedure(name, options, &block) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/gwt_rpc/client.rb', line 56 def self.add_procedure(name, , &block) procedures[name] = GwtRpc::Procedure.new(, &block) define_method name do |*parameters| self.class.procedures[name].call(self, *parameters) end define_method "#{name}_request" do |*parameters| self.class.procedures[name].request(self, *parameters) end end |
.domain(domain = nil) ⇒ Object
2 3 4 5 6 7 |
# File 'lib/gwt_rpc/client.rb', line 2 def self.domain(domain = nil) if domain @domain = domain end @domain end |
.gwt_permutation(permutation = nil) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/gwt_rpc/client.rb', line 32 def self.gwt_permutation(permutation = nil) if permutation @gwt_permutation = permutation end @gwt_permutation end |
.inherited(subclass) ⇒ Object
72 73 74 75 76 77 78 |
# File 'lib/gwt_rpc/client.rb', line 72 def self.inherited(subclass) subclass.domain self.domain subclass.js_url self.js_url subclass.timeout self.timeout subclass.map_classes @class_map end |
.java_class_to_ruby(klass) ⇒ Object
52 53 54 |
# File 'lib/gwt_rpc/client.rb', line 52 def self.java_class_to_ruby(klass) @class_map[klass.to_s] end |
.js_url(js_url = nil) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/gwt_rpc/client.rb', line 9 def self.js_url(js_url = nil) if js_url @js_url = js_url end @js_url end |
.map_classes(mapping) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/gwt_rpc/client.rb', line 41 def self.map_classes(mapping) @class_map ||= {} mapping.each_pair do |java_class, ruby_class| @class_map[java_class.to_s] = ruby_class.to_s end end |
.num_attempts(num_attempts = nil) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/gwt_rpc/client.rb', line 24 def self.num_attempts(num_attempts = nil) if num_attempts @num_attempts = num_attempts end @num_attempts ||= 10 @num_attempts end |
.procedures ⇒ Object
68 69 70 |
# File 'lib/gwt_rpc/client.rb', line 68 def self.procedures @procedures ||= {} end |
.ruby_class_to_java(klass) ⇒ Object
48 49 50 |
# File 'lib/gwt_rpc/client.rb', line 48 def self.ruby_class_to_java(klass) @class_map.invert[klass.to_s] end |
.timeout(timeout = nil) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/gwt_rpc/client.rb', line 16 def self.timeout(timeout = nil) if timeout @timeout = timeout end @timeout ||= 1000 @timeout end |