diff options
Diffstat (limited to 'Examples/ruby/enum/runme.rb')
-rw-r--r-- | Examples/ruby/enum/runme.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Examples/ruby/enum/runme.rb b/Examples/ruby/enum/runme.rb new file mode 100644 index 0000000..cd6a76f --- /dev/null +++ b/Examples/ruby/enum/runme.rb @@ -0,0 +1,30 @@ +# file: runme.rb + +require 'example' + +# ----- Object creation ----- + +# Print out the value of some enums +print "*** color ***\n" +print " RED = #{Example::RED}\n" +print " BLUE = #{Example::BLUE}\n" +print " GREEN = #{Example::GREEN}\n" + +print "\n*** Foo::speed ***\n" +print " Foo::IMPULSE = #{Example::Foo::IMPULSE}\n" +print " Foo::WARP = #{Example::Foo::WARP}\n" +print " Foo::LUDICROUS = #{Example::Foo::LUDICROUS}\n" + +print "\nTesting use of enums with functions\n\n" + +Example::enum_test(Example::RED, Example::Foo::IMPULSE) +Example::enum_test(Example::BLUE, Example::Foo::WARP) +Example::enum_test(Example::GREEN, Example::Foo::LUDICROUS) +Example::enum_test(1234, 5678) + +print "\nTesting use of enum with class method\n" +f = Example::Foo.new() + +f.enum_test(Example::Foo::IMPULSE) +f.enum_test(Example::Foo::WARP) +f.enum_test(Example::Foo::LUDICROUS) |