Files
cpp-thirdparty/winx64/bin/swig-3.0.12/Examples/ruby/functor/runme.rb
Bassem Girgis 81b4b9e273 Initial commit
2018-12-20 17:34:07 -06:00

18 lines
342 B
Ruby

# Operator overloading example
require 'example'
a = Example::IntSum.new(0)
b = Example::DoubleSum.new(100.0)
# Use the objects. They should be callable just like a normal
# Ruby function.
(0..100).each do |i|
a.call(i) # note: function call
b.call(Math.sqrt(i)) # note: function call
end
puts a.result
puts b.result