Module: RIO::Fwd

Instance Method Summary collapse

Instance Method Details

#fwd(target, *methods) ⇒ Object



33
34
35
36
# File 'lib/rio/fwd.rb', line 33

def fwd(target,*methods)
  fwd_readers target, *methods
  fwd_writers target, *methods
end

#fwd_reader(target, method) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/rio/fwd.rb', line 3

def fwd_reader(target, method)
  line_no = __LINE__
  str = %{
    def #{method}(*args, &block)
       #{target}.__send__(:#{method}, *args, &block)
    end
  }
  module_eval(str,__FILE__,line_no)
end

#fwd_readers(target, *methods) ⇒ Object



12
13
14
15
16
# File 'lib/rio/fwd.rb', line 12

def fwd_readers(target, *methods)
  methods.each do |method|
    fwd_reader target, method
  end
end

#fwd_writer(target, method) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/rio/fwd.rb', line 18

def fwd_writer(target, method)
  line_no = __LINE__
  str = %{
    def #{method}=(*args, &block)
       #{target}.__send__(:#{method}=, *args, &block)
    end
  }
  module_eval(str,__FILE__,line_no)
end

#fwd_writers(target, *methods) ⇒ Object



27
28
29
30
31
# File 'lib/rio/fwd.rb', line 27

def fwd_writers(target, *methods)
  methods.each do |method|
    fwd_writer target, method
  end
end