lib/openwfe/expressions/fe_equals.rb in openwferu-0.9.15 vs lib/openwfe/expressions/fe_equals.rb in openwferu-0.9.16

- old
+ new

@@ -28,12 +28,10 @@ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. #++ # -# $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $ -# # # "made in Japan" # # John Mettraux at openwfe.org @@ -83,11 +81,11 @@ # The bulk job of looking up the values to compare # def lookup_values (workitem) value_a = lookup_value workitem - value_b = lookup_value workitem, 'other' + value_b = lookup_value workitem, :prefix => 'other' value_c = lookup_variable_or_field workitem if not value_a and value_b value_a = value_c @@ -102,30 +100,22 @@ # Returns the value pointed at by the variable attribute or by # the field attribute, in that order. # def lookup_variable_or_field (workitem) - v = lookup_attribute :variable, workitem + v = lookup_string_attribute :variable, workitem return lookup_variable(v) if v - f = lookup_attribute :field, workitem + f = lookup_string_attribute :field, workitem return workitem.attributes[f] if f nil end - - # - # This method has to be implemented by extending classes - # - def compare (a, b) - - raise "not yet implemented : '#{@fei.expressionName}'" - end end # - # <equals/> + # <equals value="x" other-value="y"/> # class EqualsExpression < ComparisonExpression names :equals @@ -145,17 +135,17 @@ names :defined, :undefined def apply (workitem) - fname = lookup_attribute(:field_value, workitem) - fname = lookup_attribute(:field, workitem) unless fname + fname = lookup_string_attribute(:field_value, workitem) + fname = lookup_string_attribute(:field, workitem) unless fname - fmatch = lookup_attribute(:field_match, workitem) + fmatch = lookup_string_attribute(:field_match, workitem) - vname = lookup_attribute(:variable_value, workitem) - vname = lookup_attribute(:variable, workitem) unless vname + vname = lookup_string_attribute(:variable_value, workitem) + vname = lookup_string_attribute(:variable, workitem) unless vname result = if fname workitem.has_attribute? fname elsif vname lookup_variable(vname) != nil @@ -163,11 +153,11 @@ field_match?(workitem, fmatch) else false end - result = ( ! result) if result != nil \ - if fei.expression_name == 'undefined' + result = ( ! result) \ + if result != nil and fei.expression_name == 'undefined' workitem.set_result result reply_to_parent workitem end