Prev: what's ||
Next: Sorting array of names
From: Mario Camou on 15 Nov 2009 20:16 Have a look at Forwardable On Monday, November 16, 2009, Seebs <usenet-nospam(a)seebs.net> wrote: > I have a type which has a bit of internal magic, but fundamentally, I want > it to behave for most purposes like the value it yields from to_i/to_int. > > Basically, is there a way to avoid having to write +, -, etcetera, when > in each case it'd be: > def <op>(other) > self.to_i <op> other > end > > I think I'm thinking something like the Comparable mixin; sort of a > "I have a to_i, make me a number" module. > > -s > -- > Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net > http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures > http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated! > > -- -Mario. -- I want to change the world but they won't give me the source code.
|
Pages: 1 Prev: what's || Next: Sorting array of names |