lib/ruote/exp/command.rb in ruote-2.1.11 vs lib/ruote/exp/command.rb in ruote-2.2.0

- old
+ new

@@ -1,7 +1,7 @@ #-- -# Copyright (c) 2005-2010, John Mettraux, jmettraux@gmail.com +# Copyright (c) 2005-2011, 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 @@ -35,11 +35,11 @@ protected # TODO : :ignore_workitem / :disallow => 'workitem' thing ? - def get_command (workitem) + def get_command(workitem) command, step = workitem['fields'].delete(F_COMMAND) command, step = lookup_attribute_command(workitem) unless command command = 'break' if command == 'over' || command == 'stop' @@ -55,33 +55,30 @@ end [ command, step ] end - def set_command (workitem, command, step=nil) + def set_command(workitem, command, step=nil) workitem['fields'][F_COMMAND] = [ command, step ] end - def lookup_attribute_command (workitem) + def lookup_attribute_command(workitem) lookup_att_com('if', workitem) || lookup_att_com('unless', workitem) end - def lookup_att_com (dir, workitem) + def lookup_att_com(dir, workitem) ATT_COMMANDS.each do |com| - c = - attribute("#{com}_#{dir}", workitem) || - attribute("#{com}-#{dir}", workitem) + c = attribute("#{com}_#{dir}", workitem) next unless c c = Condition.true?(c) - return [ com, nil ] \ - if (dir == 'if' && c) || (dir == 'unless' && ( ! c)) + return [ com, nil ] if (dir == 'if' && c) || (dir == 'unless' && ( ! c)) end nil end end