blob: 2ab2e93f2ec82fc53fd6d473ae23372c51be22e4 (
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
|