summaryrefslogtreecommitdiff
path: root/trunk/Examples/ruby/template/runme.rb
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/Examples/ruby/template/runme.rb')
-rw-r--r--trunk/Examples/ruby/template/runme.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/trunk/Examples/ruby/template/runme.rb b/trunk/Examples/ruby/template/runme.rb
new file mode 100644
index 000000000..6c9c4ebc2
--- /dev/null
+++ b/trunk/Examples/ruby/template/runme.rb
@@ -0,0 +1,25 @@
+# file: runme.rb
+
+require 'example'
+
+# Call some templated functions
+puts Example::maxint(3, 7)
+puts Example::maxdouble(3.14, 2.18)
+
+# Create some class
+
+iv = Example::Vecint.new(100)
+dv = Example::Vecdouble.new(1000)
+
+100.times { |i| iv.setitem(i, 2*i) }
+
+1000.times { |i| dv.setitem(i, 1.0/(i+1)) }
+
+sum = 0
+100.times { |i| sum = sum + iv.getitem(i) }
+
+puts sum
+
+sum = 0.0
+1000.times { |i| sum = sum + dv.getitem(i) }
+puts sum