PageRenderTime 35ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

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

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