Sorry if this is too basic to ask. Say, I have 5 methods inside a same class. When I call each method, I need to pass the same parameters. Is there a way to simplify this and avoid the repetition?
class Class1
def method1(arg1, arg2, arg3)
puts arg1, arg2, arg3
end
def method2(arg1, arg2, arg3)
puts arg1, arg2, arg3
end
def method3(arg1, arg2, arg3)
puts arg1, arg2, arg3
end
def method4(arg1, arg2, arg3)
puts arg1, arg2, arg3
end
def method5(arg1, arg2, arg3)
puts arg1, arg2, arg3
end
end
obj1 = Class1.new
obj1.method1(1, 2, 3)
obj1.method2(4, 5, 6)
obj1.method3(7, 8, 9)
obj1.method4(10, 11, 12)
obj1.method5(13, 14, 15)
Thanks in advance!
method1,2,3, tomethod24,5,6etc