diff --git a/ruby/example.rb b/ruby/example.rb new file mode 100644 index 0000000..3738fb1 --- /dev/null +++ b/ruby/example.rb @@ -0,0 +1,27 @@ +$LOAD_PATH << '.' +require "jsh" + +def main + s = Stream.new $stdout, 4 + s.start! + 7.times do |i| + proc = {:pid => i + 1, :name => "init"} + s.output(:things, proc) + end + q = s.new_stream 'q' + q.output(:test, 'potato') + + 10.times do |i| + proc = {:pid => i + 1, :name => "init"} + s.output(:processes, proc) + end + + q.output(:test, "salad") + q.output(:test, "rocks") + + s.flush + s.stop! +end + + +main diff --git a/ruby/jsh.rb b/ruby/jsh.rb index 676dfa1..cf50116 100644 --- a/ruby/jsh.rb +++ b/ruby/jsh.rb @@ -118,28 +118,3 @@ class Stream end end - -def main - s = Stream.new $stdout, 4 - s.start! - 7.times do |i| - proc = {:pid => i + 1, :name => "init"} - s.output(:things, proc) - end - q = s.new_stream 'q' - q.output(:test, 'potato') - - 10.times do |i| - proc = {:pid => i + 1, :name => "init"} - s.output(:processes, proc) - end - - q.output(:test, "salad") - q.output(:test, "rocks") - - s.flush - s.stop! -end - - -main \ No newline at end of file