Module: ATU
- Defined in:
- lib/ruby_proxy/client.rb
Class Method Summary collapse
-
.<<(path) ⇒ Object
load path.
- .[](arg) ⇒ Object
- .[]=(arg, var) ⇒ Object
-
.const_missing(name) ⇒ Object
entry.
- .make_kclass(name, type) ⇒ Object
- .require(arg) ⇒ Object
- .require_old ⇒ Object
Class Method Details
.<<(path) ⇒ Object
load path
28 29 30 |
# File 'lib/ruby_proxy/client.rb', line 28 def <<(path) RubyProxy::DRbClient.add_load_path(path) end |
.[](arg) ⇒ Object
19 20 21 |
# File 'lib/ruby_proxy/client.rb', line 19 def [](arg) RubyProxy::DRbClient.proxy_global_get(arg) end |
.[]=(arg, var) ⇒ Object
23 24 25 |
# File 'lib/ruby_proxy/client.rb', line 23 def []=(arg,var) RubyProxy::DRbClient.proxy_global_set(arg,var) end |
.const_missing(name) ⇒ Object
entry
34 35 36 37 38 |
# File 'lib/ruby_proxy/client.rb', line 34 def self.const_missing(name) name = self.name.to_s + "::" + name.to_s type = RubyProxy::DRbClient.client.proxy_type(name) make_kclass(name,type) end |
.make_kclass(name, type) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/ruby_proxy/client.rb', line 40 def self.make_kclass(name,type) #puts "make_kclass: #{name}, #{type}" case type when "Class" RubyProxy::KlassFactory.make_class(name) do |klass| klass.class_eval do def initialize(*arg) @proxy = RubyProxy::DRbClient.client.proxy(self.class.to_s,"new",*arg) end # I think all methods should be proxyed by remote undef :type rescue nil undef :to_s undef :to_a if respond_to?(:to_a) undef :methods def __proxy @proxy end def method_missing(name,*arg,&block) #return if @proxy.nil? #puts "#{@proxy.methods(false)}" #puts "proxy = #{@proxy} method=#{name} arg=#{arg.join(',')}" @proxy.__send__(name,*arg,&block) end def self.const_missing(name) name = self.name.to_s + "::" + name.to_s type = RubyProxy::DRbClient.client.proxy_type(name.to_s) ret = ATU::make_kclass(name,type) case type when "Module","Class" return ret end RubyProxy::DRbClient.client.proxy(name.to_s) end # TODO: block not support now def self.method_missing(name,*arg,&block) RubyProxy::DRbClient.client.proxy(self.name.to_s,name.to_s,*arg,&block) end end end when "Module" RubyProxy::KlassFactory.make_module(name) do |mod| mod.class_eval do def self.method_missing(name,*arg) RubyProxy::DRbClient.client.proxy(self.name.to_s,name.to_s,*arg) end def self.const_missing(name) name = self.name.to_s + "::" + name.to_s #puts "in module const_missing : #{name}" type = RubyProxy::DRbClient.client.proxy_type(name.to_s) ret = ATU::make_kclass(name,type) case type when "Module","Class" return ret end RubyProxy::DRbClient.client.proxy(name.to_s) end end end else end end |
.require(arg) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/ruby_proxy/client.rb', line 12 def require(arg) #TODO: path maybe confict #~ path= File.expand_path File.join(Dir.pwd,arg) #~ path += '.rb' RubyProxy::DRbClient.proxy_load(arg) end |
.require_old ⇒ Object
10 |
# File 'lib/ruby_proxy/client.rb', line 10 alias require_old require |