ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-talk
ruby-talk
Re: "with" statement
by Robert Dober other posts by this author
Oct 21 2007 9:18AM messages near this date
Re: "with" statement | Re: "with" statement
On 10/21/07, Perry Smith <pedz@[...].com>  wrote:
>  Pascal has a with statement.  (I'm showing my age).  It would be nice
>  instead of:
> 
>      <td><%= h relationship.parent_id %></td>
>      <td><%= h relationship.link_type.pcln %></td>
>      <td><%= h relationship.child_id %></td>
>      <td><%= h relationship.active %></td>
>      <td><%= h relationship.notes %></td>
>      <td><%= h relationship.created_at %></td>
>      <td><%= h relationship.updated_at %></td>
> 
>  I could do:
> 
>      with(relationship) {
>        <td><%= h parent_id %></td>
>        <td><%= h link_type.pcln %></td>
>        <td><%= h child_id %></td>
>        <td><%= h active %></td>
>        <td><%= h notes %></td>
>        <td><%= h created_at %></td>
>        <td><%= h updated_at %></td>
>      }
> 
>  I bet there is a clever way to do this -- I just don't know now.
>  --
>  Posted via http://www.ruby-forum.com/.
> 
> 

You might want to have a look at instance_eval, I however feel that
the with statement was rather a weakness of Pascal.

HTH
Robert
-- 
what do I think about Ruby?
http://ruby-smalltalk.blogspot.com/
Thread:
Perry Smith
Dan Yoder
Pete Elmore
Randy Kramer
Giles Bowkett
Robert Klemme
Giles Bowkett
Stefan Rusterholz
Yossef Mendelssohn
Perry Smith
David A. Black
Robert Dober
Stephane Wirtel

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved