-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.rb
41 lines (34 loc) · 854 Bytes
/
test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require './lib/object'
require './lib/objects_hub'
class Bla
def initialize(test)
@test = test
end
def test
@test
end
end
class Blo
def initialize(test)
@test = test
end
def test
@test
end
end
# We need to add an initializer method for the Cucub-VM,
# so that each class defined in the protocol will be taked into account for Cucub messages
# after including (read it as: ".send :include") Cucub::Object behavior.
["engine", "bla"].each {|class_name|
begin
const = Kernel.const_get(class_name.capitalize)
const.send :include, Cucub::Object
rescue NameError
end
}
puts "ObjectsHub instances: #{Cucub::ObjectsHub.instance.objects.inspect}"
b = Bla.new("123")
c = Bla.new("123")
puts "ObjectsHub instances: #{Cucub::ObjectsHub.instance.objects.inspect}"
puts "b.uuid: #{b.uuid}"
puts "c.uuid: #{c.uuid}"