em_remote_call 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/em_remote_call.rb +1 -0
- data/lib/em_remote_call/server.rb +2 -2
- data/lib/em_remote_call/utils.rb +9 -0
- data/lib/em_remote_call/version.rb +1 -1
- data/spec/utils_spec.rb +27 -0
- metadata +6 -3
data/lib/em_remote_call.rb
CHANGED
@@ -7,10 +7,10 @@ class EM::RemoteCall::Call
|
|
7
7
|
@method, @argument = method, argument
|
8
8
|
|
9
9
|
if indentifier = instance_opts[:id]
|
10
|
-
klass =
|
10
|
+
klass = EM::RemoteCall::Utils.constantize(klass) or return false
|
11
11
|
@instance = klass.find(indentifier)
|
12
12
|
else
|
13
|
-
@instance =
|
13
|
+
@instance = EM::RemoteCall::Utils.constantize(klass) or return false
|
14
14
|
end
|
15
15
|
|
16
16
|
end
|
data/spec/utils_spec.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
$LOAD_PATH << File.join(File.expand_path(File.dirname(__FILE__)), '../lib')
|
2
|
+
|
3
|
+
require 'em_remote_call'
|
4
|
+
|
5
|
+
module A; end
|
6
|
+
module A::B; end
|
7
|
+
module A::B::C; end
|
8
|
+
|
9
|
+
describe EM::RemoteCall::Utils do
|
10
|
+
describe "constants" do
|
11
|
+
it "should turn a String into a Constant" do
|
12
|
+
EM::RemoteCall::Utils.constantize('A').should == A
|
13
|
+
end
|
14
|
+
end
|
15
|
+
describe "nested modules" do
|
16
|
+
it "should turn a String into a Constant" do
|
17
|
+
EM::RemoteCall::Utils.constantize('A::B').should == A::B
|
18
|
+
EM::RemoteCall::Utils.constantize('A::B::C').should == A::B::C
|
19
|
+
end
|
20
|
+
end
|
21
|
+
describe "non existing constants" do
|
22
|
+
it "should return false (this is just how we need it)" do
|
23
|
+
EM::RemoteCall::Utils.constantize('D').should == false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Niko Dittmann
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-12-01 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -67,9 +67,11 @@ extra_rdoc_files: []
|
|
67
67
|
files:
|
68
68
|
- lib/em_remote_call/client.rb
|
69
69
|
- lib/em_remote_call/server.rb
|
70
|
+
- lib/em_remote_call/utils.rb
|
70
71
|
- lib/em_remote_call/version.rb
|
71
72
|
- lib/em_remote_call.rb
|
72
73
|
- spec/integration_spec.rb
|
74
|
+
- spec/utils_spec.rb
|
73
75
|
has_rdoc: true
|
74
76
|
homepage: http://github.com/niko/em_remote_call
|
75
77
|
licenses: []
|
@@ -104,3 +106,4 @@ specification_version: 3
|
|
104
106
|
summary: Provides an Eventmachine server/client couple which allows the client to call methods within the server process, including local client-callbacks.
|
105
107
|
test_files:
|
106
108
|
- spec/integration_spec.rb
|
109
|
+
- spec/utils_spec.rb
|