From: "Peña, Botp" Date: 2005-05-06T13:25:29+09:00 Subject: Re: object reference handle (like perl's reference to scalar) Eric Mahurin [mailto:eric_mahurin@yahoo.com] wrote: #Below is what I think is a general purpose solution to making #references. I provide several ways to do it. Here is an #example: # #a = (0..5).to_a -> [0,1,2,3,4,5] #w = ref{"a[2..4]"} # uses eval #x = a.ref[2..4] # uses [] and []= methods #y = a.ref("[]","[]=",2..4) # specify methods manually #z = a.ref(["[]",2..4],["[]=",2..4]) # unique args to get/set #w[] -> [2,3,4] #x[] -> [2,3,4] #y[] -> [2,3,4] #z[] -> [2,3,4] #w[]=(11..14).to_a #a -> [0,1,11,12,13,14,5] #x[]=[4,3,2] #a -> [0,1,4,3,2,14,5] #y[]=[0,1] #a -> [0,1,0,1,14,5] #z[]=[2,3,4] #a -> [0,1,2,3,4,5] cool. is it possible to remove the [] appendix? :-) something like, hacker = ["bot","pen","a",5,10] name = hacker.ref[0..2] fname = name.ref[0] lname = name.ref[1] mname = name.ref[2] height = hacker.ref[3..4] feet = height.ref[1] inches = height.ref[2] fname = "Eric" lname = "Mahurin" mname = "?" feet = 6 inches = 5 name #=> ["Eric","Mahurin","?"] height #=> [6,5] hacker #=> ["Eric","Mahurin","?",6,5] Possible? btw, i cannot download your reference gem... thanks and kind regards -botp