PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-29/SWIG/Examples/test-suite/ruby/director_detect_runme.rb

#
Ruby | 43 lines | 30 code | 13 blank | 0 comment | 6 complexity | f1e302b80f616c56dcdeca7a8b7eb987 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. require 'director_detect'
  2. class MyBar < Director_detect::Bar
  3. def initialize(v)
  4. @val = v
  5. end
  6. def get_value
  7. @val = @val + 1
  8. end
  9. def get_class
  10. @val = @val + 1
  11. Director_detect::A
  12. end
  13. def just_do_it
  14. @val = @val + 1
  15. end
  16. def clone
  17. MyBar.new(@val)
  18. end
  19. def val
  20. @val
  21. end
  22. end
  23. b = MyBar.new(2)
  24. f = b
  25. v = f.get_value
  26. a = f.get_class
  27. f.just_do_it
  28. c = b.clone
  29. vc = c.get_value
  30. raise RuntimeError if (v != 3) || (b.val != 5) || (vc != 6)