PageRenderTime 44ms CodeModel.GetById 15ms app.highlight 5ms RepoModel.GetById 23ms 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
 1require 'director_detect'
 2
 3class MyBar < Director_detect::Bar
 4  def initialize(v)
 5    @val = v
 6  end
 7
 8  def get_value
 9    @val = @val + 1
10  end
11  
12  def get_class
13    @val = @val + 1
14    Director_detect::A
15  end
16
17  def just_do_it
18    @val = @val + 1
19  end
20
21  def clone
22    MyBar.new(@val)
23  end
24
25  def val
26    @val
27  end
28end
29
30
31b = MyBar.new(2)
32
33f = b
34
35v = f.get_value
36a = f.get_class
37f.just_do_it
38
39c = b.clone
40vc = c.get_value
41
42raise RuntimeError if (v != 3) || (b.val != 5) || (vc != 6)
43