On Sun, Sep 12, 2010 at 1:28 AM, Cameron Vessey <cameron1inm / hotmail.com> wrote:
> Thanks for the reply and I think I get it now
>
> if we delete element 50
> element 51 gets sloted into 50
> then the pointer moves to 51 never addressing the original 51..ok
>
> page.links.delete_if{|link| link =~ /(Blog|About
> Us|Status|Help|TOS|Privacy|Are we missing an area?)/
> }
>
> I tried it .. it runs... no errors... It loops threw all the link
> elements.. but never does any thing.. nothing gets deleted
>
>
> I see how it should work ...but it doesn't

Maybe page.links returns a new array every time you call it instead of
an access to an internal structure.  This would mean you modify a copy
and not the original data.  You could verify by doing

3.times do
  puts page.links.object_id
end

If you see different object ids chances are that you get a copy and
are not modifying the original structure.

Kind regards

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/