summaryrefslogtreecommitdiffstats
path: root/examples/hello_world.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-06-13 00:23:37 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-06-13 00:23:37 +0200
commit1c7dfa63d6584f3a605f56d2bb26d5769122f6a9 (patch)
treeae7b6b8a85bfb2e5de2afa4fc631efce77d3ec76 /examples/hello_world.rb
parent784af2138ddf5477db5a23d1ddd948437a744b2f (diff)
downloadedoors-ruby-1c7dfa63d6584f3a605f56d2bb26d5769122f6a9.zip
edoors-ruby-1c7dfa63d6584f3a605f56d2bb26d5769122f6a9.tar.gz
improve hello_world.rb comments
Diffstat (limited to 'examples/hello_world.rb')
-rw-r--r--examples/hello_world.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/examples/hello_world.rb b/examples/hello_world.rb
index db5bdb6..3976d6f 100644
--- a/examples/hello_world.rb
+++ b/examples/hello_world.rb
@@ -6,13 +6,14 @@
# run this script which builds the example system and spin it untill it's empty:
# $ ruby -Ilib examples/hello_world.rb
#
-# or load the system from a JSON specification ( created with spin.hibernate! )
+# or load the system from a JSON specification ( created with dom0.hibernate! )
# $ ruby -Ilib bin/edoors.rb -r examples/hello_world.rb examples/hello_world.json
#
require 'edoors'
#
class InputDoor < Edoors::Door
#
+ # see Iota class for the different methods to override
def start!
# stimulate myself on system boot up
# if an action is set, but no destination is, it will be self.
@@ -22,7 +23,7 @@ class InputDoor < Edoors::Door
#
def receive_p p
if p.action==Edoors::ACT_GET
- # if desired (not needed here), call reset! to clear particle's data,
+ # if desired (not necessary here), call reset! to clear particle's data,
# meaning merge particle, payload, destinations
# see Particle#reset!
p.reset!
@@ -66,6 +67,10 @@ if $0 == __FILE__
# schedule the spinning particles untill the system cools down
dom0.spin!
#
+ # you can save the system state after it's run,
+ # but to be able to use it to bootstrap, the hibernation attribute must be set to false
+ # otherwise start! method is not called
+ # dom0.hibernate! 'hello_world.json'
end
#
# EOF