lib/ruote/exp/fe_command.rb in ruote-2.2.0 vs lib/ruote/exp/fe_command.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
@@ -27,12 +27,12 @@
module Ruote::Exp
#
- # This class gathers the 'skip', 'back', 'jump', 'rewind', 'continue' and
- # 'break' expressions which are used inside of the 'cursor' and 'repeat'
+ # This class gathers the 'skip', 'back', 'jump', 'rewind', 'continue', 'reset'
+ # and 'break' expressions which are used inside of the 'cursor' and 'repeat'
# (loop) expressions.
#
# Look at the 'cursor' expression Ruote::Exp::Cursor for a discussion of
# each of those [sub]expressions.
#
@@ -85,10 +85,14 @@
#
class CommandExpression < FlowExpression
include CommandMixin
- names :skip, :back, :jump, :rewind, :continue, :break, :stop, :over
+ names :skip, :back, :jump, :rewind, :continue, :break, :stop, :over, :reset
+
+ # Used by FlowExpression when dealing with :on_error or :on_timeout
+ #
+ REGEXP = Regexp.new("^(#{expression_names.join('|')})( .+)?$")
def apply
param = case name
when 'skip', 'back' then attribute(:step) || attribute_text