On Thu, Sep 8, 2011 at 10:12 AM, rahul patil
<rahul.deshmukhpatil / gmail.com>wrote:

> may be you could write
>
> On Wed, Sep 7, 2011 at 1:18 PM, Intransition <transfire / gmail.com> wrote:
>
>>
>>
>> On Sep 6, 7:52 pm, "Aaron D. Gifford" <astound... / gmail.com> wrote:
>> > Just move things around a bit and you'll notice you've already got the
>> > behavior you want (or pretty close):
>> >
>> > irb(main):001:0> arr = [0,1,2,3,4]
>> > => [0, 1, 2, 3, 4]
>> > irb(main):002:0> [0..-2, -1].map{|i| arr[i]}
>> > => [[0, 1, 2, 3], 4]
>> > irb(main):003:0> [0, 2..3, 4..-1].map{|i| arr[i]}
>> > => [0, [2, 3], [4]]
>> >
>> > So just put the list of group selectors first, execute a map/collect
>> > on it and access the original array slices you want.
>> >
>> > Aaron out.
>>
>>
> just modified Aaron code
>
> class Range
>     def to_range
>         self
>     end
> end
>
> class Fixnum
>     def to_range
>         puts "Fixnum methid"
>
sorry, just remove this puts !!!

>         a=Range.new(self, self)
>     end
> end
> range=[0, 2..3, 4..-1, 2..2]
> array=[0,1,2,3,4]
> puts "#{range.map {|id| id=id.to_range; array[id]}}"
>
> How does it looks? it gives same o/p as urs !!!
>
>> Ah, of course. Thanks.
>>
>>
>
>
> --
> Regards,
> Rahul Patil
>



-- 
Regards,
Rahul Patil