From: Florian Gilcher Date: 2008-03-13T06:00:55+09:00 Subject: Re: a method that checks if an object is in a range On Mar 12, 2008, at 9:20 PM, wojtek@m4chu.net wrote: > Florian, > > Yeah, I know about monkey patching thing, and I wanted to avoid it. I don't consider this monkey patching. You are extending - there is nothing wrong with that. I just wanted to give a reference to the topic where this example was used. Monkey patching would be to change behaviour of methods to fit your needs (or to fix bugs that are not yet fixed). > > Well, I certainly have chosen somewhat wrong name for the method; all > I wanted to do is to check whether object is in range. Within or, > Between are better ones (I knew about that one Daniel, it's just I > prefer ranges over min/max :). > > I couldn't agree more with your approach to object/group; but > conversations like > "is 13 between 0 and 59" > "is that date between 1.week.ago and 1.week.from_now" > sounds reasonable too :) That is absolutely true. A comparison is defined in both ways, so there are many ways to express it. So extending Comparable was the right way to start. If you really think you are lacking a way to express yourself, help yourself to it. Reformulating sentences doesn't help, though ;). Greetings Florian Gilcher