From: Phrogz Date: 2007-09-01T14:15:09+09:00 Subject: Re: Method names and alias On Aug 31, 1:47 pm, darren kirby wrote: > My code would be considerably DRYer if I could make 'load_byte_unsigned' an > alias to 'load_byte', and have the method inspect the name it was called as > to decide if it should run 'bitstring_to_int(byte, signed=false)' or not. > > Is there a way to do this? I can't offer you a way to do this, but: > If not, I suppose my best bet is to move the snipped 15 lines to > a 'load_byte_common' method and make 'load_byte' and 'load_byte_unsigned' > thin wrappers around it? I'd personally do something like: def load_byte( byte, unsigned=false ) #...your code here... end def load_byte_unsigned( byte ) load_byte( byte, true ) end A (private?) utility function is certainly possible, but not the way I'd go, or needed.