PageRenderTime 28ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/test-suite/ruby/director_nested_runme.rb

#
Ruby | 54 lines | 32 code | 14 blank | 8 comment | 4 complexity | 64a401035297efb487e65adfa3054260 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. #!/usr/bin/env ruby
  2. #
  3. # Put description here
  4. #
  5. #
  6. #
  7. #
  8. #
  9. require 'swig_assert'
  10. require 'director_nested'
  11. NoProtectedError = Kernel.const_defined?("NoMethodError") ? NoMethodError : NameError
  12. class A < Director_nested::FooBar_int
  13. protected
  14. def do_step
  15. "A::do_step;"
  16. end
  17. def get_value
  18. "A::get_value"
  19. end
  20. end
  21. a = A.new
  22. begin
  23. a.do_advance
  24. rescue NoProtectedError
  25. end
  26. raise RuntimeError if a.step != "Bar::step;Foo::advance;Bar::do_advance;A::do_step;"
  27. class B < Director_nested::FooBar_int
  28. protected
  29. def do_advance
  30. "B::do_advance;" + do_step
  31. end
  32. def do_step
  33. "B::do_step;"
  34. end
  35. def get_value
  36. "B::get_value"
  37. end
  38. end
  39. b = B.new
  40. raise RuntimeError if b.step != "Bar::step;Foo::advance;B::do_advance;B::do_step;"