On Apr 6, 2008, at 9:56 AM, I=F1aki Baz Castillo wrote:
> El Domingo, 6 de Abril de 2008, Phillip Gawlowski escribi=F3:
>
>>
>> Have you looked at #method_missing, and it's relatives, like
>> #instance_variable_set?
>
> Ok, but my purpose was in fact:
>
> 	def method1, method2 (args)
> 		...
> 		super <-- so it call to "method1" or "method2" depending
> 		...
> 	end

Here's one way you might go about that:

class Parent
   def example1
     puts "In example 1."
   end

   def example2
     puts "In example 2."
   end
end

class Child < Parent
   %w[1 2].each do |suffix|
     define_method("example#{suffix}") do
       puts "Forwarding to example #{suffix}..."
       super
     end
   end
end

c =3D Child.new
c.example1
c.example2

__END__

Hope that helps.

James Edward Gray II=