lib/ruote/exp/fe_restore.rb in ruote-2.2.0 vs lib/ruote/exp/fe_restore.rb in ruote-2.3.0

- old
+ new

@@ -1,7 +1,7 @@ #-- -# Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com +# Copyright (c) 2005-2012, John Mettraux, jmettraux@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell @@ -54,23 +54,23 @@ # end # class RestoreExpression < FlowExpression include MergeMixin + # still have to implement something about merge... names :restore, :set_fields def apply from = has_attribute(*%w[ v var variable ].map { |k| "from_#{k}" }) || has_attribute(*%w[ f fld field ].map { |k| "from_#{k}" }) || has_attribute(*%w[ val value ]) - to = - has_attribute(*%w[ f fld field ].map { |k| "to_#{k}" }) || - has_attribute('to') + _, to_f = determine_tos + # note : to_v is discarded (the underscore) from = 'from_var' if from == 'from_v' afrom = attribute(from) @@ -80,11 +80,11 @@ Ruote.lookup(h.applied_workitem['fields'], afrom) else # val afrom end - if to - Ruote.set(h.applied_workitem['fields'], attribute(to), fields) + if to_f + Ruote.set(h.applied_workitem['fields'], to_f, fields) else h.applied_workitem['fields'] = fields end # TODO : merge strategies