From: Jamis Buck Date: 2004-10-11T13:29:27+09:00 Subject: Re: Change exclusive on Range trans. (T. Onoma) wrote: > On Sunday 10 October 2004 10:34 pm, Florian Gross wrote: > | trans. (T. Onoma) wrote: > | > How do I change the end exclusivity of a pre-existing range? > | > | In theory this is impossible because Ranges are designed to be immutable > | objects. > | > | For other objects it is possible to change them via .send(:initialize), > | but Ranges have a check for that. > | > | I think the only option would be using evil-ruby, for now. > | > | But why do you need this? > > Testing some modifications to Range. One of them is the addition of > exclude_first? Then I wanted to try out this alternate notation: > > -(0..9) # exclude end > +(0..9) # exclude first > ~(0..9) # exclude both > > Using unary operators, since they have no other meaning for ranges anyway. Interesting approach! That's rather novel. Thanks for sharing. :) - Jamis -- Jamis Buck jgb3@email.byu.edu http://www.jamisbuck.org/jamis