update comment.
[ruby-svn.git] / doc / forwardable.rd.ja
blob48186b111f24e5e8efe352aea5ce239e845497a1
1   -- forwatable.rb
2                                                 $Release Version: 1.1 $
3                                                 $Revision$
5 =begin
6 = Forwardable
8 ¥¯¥é¥¹¤ËÂФ·¥á¥½¥Ã¥É¤Î°Ñ¾ùµ¡Ç½¤òÄêµÁ¤·¤Þ¤¹.
10 == »È¤¤Êý
12 ¥¯¥é¥¹¤ËÂФ·¤Æextend¤·¤Æ»È¤¤¤Þ¤¹. 
13   
14   class Foo
15     extend Forwardable
17     def_delegators("@out", "printf", "print")
18     def_delegators(:@in, :gets)
19     def_delegator(:@contents, :[], "content_at")
20   end
21   f = Foo.new
22   f.printf ...
23   f.gets
24   f.content_at(1)
26 == ¥á¥½¥Ã¥É
28 --- Forwardable#def_instance_delegators(accessor, *methods)
30       ((|methods|))¤ÇÅϤµ¤ì¤¿¥á¥½¥Ã¥É¤Î¥ê¥¹¥È¤ò((|accessor¤Ë|))°Ñ¾ù¤¹¤ë
31       ¤è¤¦¤Ë¤·¤Þ¤¹.
33 --- Forwardable#def_instance_delegator(accessor, method, ali = method)
35       ((||method|))¤ÇÅϤµ¤ì¤¿¥á¥½¥Ã¥É¤ò((|accessor|))¤Ë°Ñ¾ù¤¹¤ë¤è¤¦¤Ë¤·
36       ¤Þ¤¹. ((|ali|))¤¬°ú¿ô¤È¤·¤ÆÅϤµ¤ì¤¿¤È¤­¤Ï, ¥á¥½¥Ã¥É((|ali|))¤¬¸Æ¤Ð
37       ¤ì¤¿¤È¤­¤Ë¤Ï, ((|accessor|))¤ËÂФ·((|method|))¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹.
39 --- Forwardable#def_delegators(accessor, *methods)
41       ((|Forwardable#def_instance_delegators|))¤ÎÊÌ̾¤Ç¤¹.
43 --- Forwardable#def_delegator(accessor, method, ali = method)
45       ((|Forwardable#def_instance_delegator|))¤ÎÊÌ̾¤Ç¤¹.
47 = SingleForwardable
49 ¥ª¥Ö¥¸¥§¥¯¥È¤ËÂФ·, ¥á¥½¥Ã¥É¤Î°Ñ¾ùµ¡Ç½¤òÄêµÁ¤·¤Þ¤¹.
51 == »È¤¤Êý
53 ¥ª¥Ö¥¸¥§¥¯¥È¤ËÂФ·¤Æ((|extend|))¤·¤Æ»È¤¤¤Þ¤¹. 
55   g = Goo.new
56   g.extend SingleForwardable
57   g.def_delegator("@out", :puts)
58   g.puts ...
60 == ¥á¥½¥Ã¥É
62 --- SingleForwardable#def_singleton_delegators(accessor, *methods)
64       ((|methods|))¤ÇÅϤµ¤ì¤¿¥á¥½¥Ã¥É¤Î¥ê¥¹¥È¤ò((|accessor|))¤Ë°Ñ¾ù¤¹¤ë
65       ¤è¤¦¤Ë¤·¤Þ¤¹.
67 --- SingleForwardable#def_singleton_delegator(accessor, method, ali = method)
69       ((|method|))¤ÇÅϤµ¤ì¤¿¥á¥½¥Ã¥É¤ò((|accessor|))¤Ë°Ñ¾ù¤¹¤ë¤è¤¦¤Ë¤·¤Þ
70       ¤¹. ((|ali|))¤¬°ú¿ô¤È¤·¤ÆÅϤµ¤ì¤¿¤È¤­¤Ï, ¥á¥½¥Ã¥É((|ali|))¤¬¸Æ¤Ð¤ì
71       ¤¿¤È¤­¤Ë¤Ï, ((|accessor|))¤ËÂФ·((|method|))¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹.
73 --- SingleForwardable#def_delegators(accessor, *methods)
75       ((|SingleForwardable#def_singleton_delegators|))¤ÎÊÌ̾¤Ç¤¹.
77 --- SingleForwardable#def_delegator(accessor, method, ali = method)
79       ((|SingleForwardable#def_singleton_delegator|))¤ÎÊÌ̾¤Ç¤¹.
80 =end