diff options
Diffstat (limited to 'Examples/ruby/exceptproxy/runme.rb')
-rw-r--r-- | Examples/ruby/exceptproxy/runme.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Examples/ruby/exceptproxy/runme.rb b/Examples/ruby/exceptproxy/runme.rb new file mode 100644 index 000000000..c198c1406 --- /dev/null +++ b/Examples/ruby/exceptproxy/runme.rb @@ -0,0 +1,45 @@ +require 'example' + +q = Example::IntQueue.new(10) + +puts "Inserting items into intQueue" + +begin + 0.upto(100) do |i| + q.enqueue(i) + end +rescue Example::FullError => e + puts "Maxsize is: #{e.maxsize}" +end + +puts "Removing items" + +begin + loop do + q.dequeue() + end +rescue Example::EmptyError => e + ## do nothing +end + +q = Example::DoubleQueue.new(1000) + +puts "Inserting items into doubleQueue" + +begin + 0.upto(100) do |i| + q.enqueue(i*1.5) + end +rescue Example::FullError => e + puts "Maxsize is: #{e.maxsize}" +end + +puts "Removing items" + +begin + loop do + q.dequeue() + end +rescue Example::EmptyError => e + # do nothing +end |