PageRenderTime 22ms CodeModel.GetById 13ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/ruby/enum/runme.rb

#
Ruby | 30 lines | 19 code | 8 blank | 3 comment | 0 complexity | c0a0c3138d3701974ec752e8a374ad16 MD5 | raw file
 1# file: runme.rb
 2
 3require 'example'
 4
 5# ----- Object creation -----
 6
 7# Print out the value of some enums
 8print "*** color ***\n"
 9print "    RED    = #{Example::RED}\n"
10print "    BLUE   = #{Example::BLUE}\n"
11print "    GREEN  = #{Example::GREEN}\n"
12
13print "\n*** Foo::speed ***\n"
14print "    Foo::IMPULSE   = #{Example::Foo::IMPULSE}\n"
15print "    Foo::WARP      = #{Example::Foo::WARP}\n"
16print "    Foo::LUDICROUS = #{Example::Foo::LUDICROUS}\n"
17
18print "\nTesting use of enums with functions\n\n"
19
20Example::enum_test(Example::RED, Example::Foo::IMPULSE)
21Example::enum_test(Example::BLUE,  Example::Foo::WARP)
22Example::enum_test(Example::GREEN, Example::Foo::LUDICROUS)
23Example::enum_test(1234, 5678)
24
25print "\nTesting use of enum with class method\n"
26f = Example::Foo.new()
27
28f.enum_test(Example::Foo::IMPULSE)
29f.enum_test(Example::Foo::WARP)
30f.enum_test(Example::Foo::LUDICROUS)