PageRenderTime 16ms CodeModel.GetById 12ms app.highlight 3ms RepoModel.GetById 1ms 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
 1#!/usr/bin/env ruby
 2#
 3# Put description here
 4#
 5# 
 6# 
 7# 
 8#
 9
10require 'swig_assert'
11
12require 'director_nested'
13
14NoProtectedError = Kernel.const_defined?("NoMethodError") ? NoMethodError : NameError
15
16class A < Director_nested::FooBar_int
17  protected
18    def do_step
19      "A::do_step;"
20    end
21  
22    def get_value
23      "A::get_value"
24    end
25end
26
27a = A.new
28
29begin 
30  a.do_advance
31rescue NoProtectedError
32end
33
34raise RuntimeError if a.step != "Bar::step;Foo::advance;Bar::do_advance;A::do_step;"
35
36
37class B < Director_nested::FooBar_int
38  protected
39    def do_advance
40      "B::do_advance;" + do_step
41    end
42
43    def do_step
44      "B::do_step;"
45    end
46  
47    def get_value
48      "B::get_value"
49    end
50end
51
52
53b = B.new
54raise RuntimeError if b.step != "Bar::step;Foo::advance;B::do_advance;B::do_step;"