[TTK-Patches] [ruby_ex] 319: Add a support to catch match data
in RPath.
Nicolas Pouillard
nicolas.pouillard at gmail.com
Thu Jul 7 14:55:15 EDT 2005
On 7/7/05, Nicolas Desprès <nicolas.despres at gmail.com> wrote:
> On 7/7/05, Nicolas Pouillard <ertai at lrde.epita.fr> wrote:
> >
> > svn://svn.feydakins.org/ruby_ex/trunk
> >
> > Index: ChangeLog
> > from Nicolas Pouillard <ertai at lrde.epita.fr>
> >
> > Add a support to catch match data in RPath.
> >
> > * lib/rpath.rb: Add rpath_find(:first | :all), rpath_select_match_data,
> > match data support, and add tests.
> >
>
> [...]
>
> > #
> > + # tree.rpath('/B//*home/(.*)') { |tree, home| p [home, tree[:email]] }
> > + # => [ 'here', 'foo at foo.com' ]
> > + # => [ "bar's home", 'bar at foo.bar' ]
> > + # => [ 'nowhere', 'baz at bar.com' ]
> > + #
>
> Is the number of bound variables is equal to the number matched part?
> Maybe a second
> example could be a good thing...
>
One more, because there is the tree.
When you do not put parenthesis in your expression you get one argument, right?
When you match some parts you get these values in extra arguments.
--
Nicolas Pouillard aka Ertai <ertai at feydakins.org>
http://www.feydakins.org TTK -- TestToolKit
_______________________________________________
TTK-Patches mailing list
TTK-Patches at lists.feydakins.org
http://mailman.feydakins.org/mailman/listinfo/ttk-patches
More information about the ttk-patches
mailing list