PageRenderTime 12ms CodeModel.GetById 1ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Ruby | 54 lines | 31 code | 15 blank | 8 comment | 6 complexity | 713b16b5a958ed8102402992c4e5fb62 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_detect'
13
14class MyBar < Director_detect::Bar
15  def initialize(v)
16    @val = v
17  end
18
19  def get_value
20    @val = @val + 1
21  end
22  
23  def get_class
24    @val = @val + 1
25    Director_detect::A
26  end
27
28  def just_do_it
29    @val = @val + 1
30  end
31
32  def clone
33    MyBar.new(@val)
34  end
35
36  def val
37    @val
38  end
39end
40
41
42b = MyBar.new(2)
43
44f = b
45
46v = f.get_value
47a = f.get_class
48f.just_do_it
49
50c = b.clone
51vc = c.get_value
52
53raise RuntimeError if (v != 3) || (b.val != 5) || (vc != 6)
54