From: Daniel Brumbaugh Keeney Date: 2008-03-13T03:59:35+09:00 Subject: Re: a method that checks if an object is in a range On Wed, Mar 12, 2008 at 12:59 PM, wrote: > Hi, > > I wonder if there is a built-in method which does just like: > > range.include?(obj) > > but for the obj object. I came up with something like: > > module Comparable > def in?(range) > range.in?(self) > end > end > > 1.in? (1..10) # => true > > Of course I can use the range.include? syntax, but I find the second > approach more convenient :) > > Regards, > m4chu I personally am not a fan of such methods, but perhaps Comparable#between will satisfy you. Daniel Brumbaugh Keeney