repo.or.cz
/
ruby-svn.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
r18455 reverted.
[ruby-svn.git]
/
sample
/
export.rb
blob
949e5b10bf135f5e19106148d0e2318148065c02
1
# method access permission
2
# output:
3
# foobar
4
# Foo
5
6
class Foo
7
public :printf
8
def baz
9
print "baz\n"
10
end
11
private :baz
12
13
def quux
14
print "in QUUX "
15
baz()
16
end
17
end
18
19
def foobar
20
print "foobar\n"
21
end
22
23
f = Foo.new
24
#Foo.private :printf
25
class Foo # redefines foobar's scope
26
public :foobar
27
end
28
f.foobar
29
f.printf "%s\n", Foo
30
31
f.quux
32
33
class Bar<Foo
34
def quux
35
super
36
baz()
37
end
38
end
39
40
Bar.new.quux