Thiel,
:elements gets captured and becomes available in the block's context. If you
want the output to be a hash, you have to have {:result => element } in the
block. But then your transformation rule does nothing, so I don't see why
you'd want to.

I couldn't follow your example very well. Perhaps that's why no one has
responded yet. Try articulating your problem again if you're still having
trouble.

Jason

On Wed, May 18, 2011 at 5:55 AM, Thiel Chang <[email protected]> wrote:

>  Hi guys,
>
> I am still struggling with the transformation rules. :-(
>
> My aim is to understand the application of sequence(symbol)  in
> transformation rules.
>
>  So, I made a simple test to replace an array of objects in a
> transformation rule.
>
> The input tree for Transform is:
>
> { :result =>  [{ :w => "a" }, { :x => "b" } , { :y => "c", :z => "d"} ] }
>
> and the transformation rule is:
>
> rule( :result => sequence(:elements) ) {   puts elements.inspect  }
>
>  The new array is: [ "imf", strauss", "kahn"]
>
> The required result should be:   { :result => [ "imf", "strauss", "kahn" ]
> }
>
> I would be very glad if anyone can provide the solution(s).
>
> Many thanks in advance,
>
> Thiel
>
>
>
>

Reply via email to