classWriterdefself.type(*w)# "*" is known as "splat" operatorw.join('')endendWriter.type# >> ""Writer.type("1")# >> "1"Writer.type("1","2","3")# >> "123"
Say “hello” to the splat operator *, a greedy fellow that swallows up all
arguments, from its position onwards, the assigned variable (w in the
above example) becomes an array that contains all the captured arguments.
5. One argument is required while the rest are optional & can be any number
123456789
classWriterdefself.type(w1,*w)# again, we have the "*" (splat) operator"w1"+w.join("")endendWriter.type# >> ArgumentErrorWriter.type("1")# >> "1"Writer.type("1","2","3")# >> "123"