summaryrefslogtreecommitdiff
path: root/jni/ruby/sample/export.rb
blob: 949e5b10bf135f5e19106148d0e2318148065c02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# method access permission
# output:
#       foobar
#       Foo

class Foo
  public :printf
  def baz
    print "baz\n"
  end
  private :baz

  def quux
    print "in QUUX "
    baz()
  end
end

def foobar
  print "foobar\n"
end

f = Foo.new
#Foo.private :printf
class Foo                       # redefines foobar's scope
  public :foobar
end
f.foobar
f.printf "%s\n", Foo

f.quux

class Bar<Foo
  def quux
    super
    baz()
  end
end

Bar.new.quux