1 |
# Purpose: FreeRIDE databus test |
# Purpose: FreeBASE databus test |
2 |
# |
# |
3 |
# $Id$ |
# $Id$ |
4 |
# |
# |
14 |
# Copyright (c) 2001 Rich Kilmer. All rights reserved. |
# Copyright (c) 2001 Rich Kilmer. All rights reserved. |
15 |
# |
# |
16 |
|
|
17 |
require 'freeride/databus' |
require 'freebase/databus' |
18 |
|
|
19 |
class SubscriptionTest |
class SubscriptionTest |
20 |
def databus_notify(event, slot) |
def databus_notify(event, slot) |
23 |
end |
end |
24 |
|
|
25 |
# test data |
# test data |
26 |
databus = FreeRIDE::DataBus.new |
databus = FreeBASE::DataBus.new |
27 |
databus["/"].subscribe {|event, slot| puts "data to #{slot.path}"} |
databus["/"].subscribe {|event, slot| puts "data to #{slot.path}"} |
28 |
st = SubscriptionTest.new |
st = SubscriptionTest.new |
29 |
databus["/foo/bar"].subscribe(st) |
databus["/foo/bar"].subscribe(st) |
91 |
puts slot["././."].path |
puts slot["././."].path |
92 |
puts slot["/foo/bar///queue"].path |
puts slot["/foo/bar///queue"].path |
93 |
puts slot["///foo///bar///queue"].path |
puts slot["///foo///bar///queue"].path |
94 |
|
|
95 |
|
slot["test"].attr_foo = "foo" |
96 |
|
puts slot["test"].attr_foo |