From: Adam Shelly Date: 2006-10-03T03:39:30+09:00 Subject: redefining splat? Can you redefine the * prefix operator? I'm in the middle of refactoring some code. I have a function that looks like this def send_command cmd_arry type = cmd_arry.shift @comms.send(type, *cmd_arry) end I want to replace the command arrays (which have the form [:COMMAND, data1, data2, ...]) with a class structure like: class LogonCommand < Command def initialize name, pass super() @name,@pass = name,pass @command = :LOGON end def write [@command, @name, @pass] end end but there are a lot of these command types, and I wanted to do a gradual transition. So I thought I could make the Command class mimic the array: class Command def shift @command end def * *(write[1..-1]) end end but that gives a syntax error. Is there any way to redefine the splat for my class? Or at least to make my class act like an array when the splat is applied? -Adam