On Wed, Mar 14, 2012 at 10:21:37AM -0700, Chris Conley wrote:
>
> Say I have a field "original_hash" set to {"a" => "1"}, and want to set it
> to another field like:
>
> set "f:hash_copy" => "${original_hash}"
>
> The field "hash_copy" is now a string, not a hash: "{\"a\"=>\"1\"}"
>
> Is there a way to do this so that the hash gets set into the new field, and
> not a stringified hash?

Hello Chris,

I updated the "set" documentation about that case:

  
https://github.com/jmettraux/ruote/commit/ec7aa793741d2393b1eec7324c9f6b1552086315

Here is the gist of it:

| === shorter form and non-string values
|
| Dollar substitutions like '${a}' will always squash the field or the
| variable into a string. It's useful, especially when one is doing
| 'user-${name}', but when the field (or variable) is an array or an hash
|
|   set 'f' => '${array}'
|
| will put the string representation of array into the field 'f', not
| a copy of the array itself.
|
| This will copy the array into the field 'f':
|
|   set 'f' => '$f:array'
|
| Note the mandatory 'f:'. There is a thing to be aware of: if the field
| array is missing, it will resolve into "$f:array" (no substitution at all).
|
| There is always the old-style fallback:
|
|   set :field => 'f', :field_value => 'array'


I hope it helps, best regards,

--
John Mettraux - http://lambda.io/processi

-- 
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en

Reply via email to