lib/openwfe/expressions/raw_prog.rb in openwferu-0.9.8 vs lib/openwfe/expressions/raw_prog.rb in openwferu-0.9.9

- old
+ new

@@ -153,33 +153,36 @@ exp.children << result \ if result and result.kind_of? String context.pop_parent_expression - return exp + exp end + def do_make + ProcessDefinition.do_make(self) + end + # # A class method for actually "making" the process # segment raw representation # - def ProcessDefinition.do_make () + def ProcessDefinition.do_make (instance=nil) - context = nil - - if @ccontext - context = @ccontext - else + context = if @ccontext + @ccontext + elsif instance + instance.make + instance.context + else pdef = self.new pdef.make - context = pdef.context + pdef.context end - exp = context.top_expression + return context.top_expression if context.top_expression - return exp if exp - name, revision = extract_name_and_revision(self.metaclass.to_s[8..-2]) attributes = {} attributes["name"] = name @@ -188,11 +191,11 @@ top_expression = SimpleExpRepresentation.new( "process-definition", attributes) top_expression.children = context.top_expressions - return top_expression + top_expression end protected def ProcessDefinition.pack_args (args) @@ -216,17 +219,17 @@ return [ as_name(m[1]), as_revision(m[2]) ] if m m = Regexp.compile(".*::(.*$)").match(s) return [ as_name(m[1]), '0' ] if m - return [ as_name(s), '0' ] + [ as_name(s), '0' ] end def ProcessDefinition.as_name (s) return s[0..-11] if s.match(".*Definition$") - return s + s end def ProcessDefinition.as_revision (s) s.gsub("_", ".") end @@ -267,11 +270,11 @@ # def top_expression return nil if @top_expressions.size > 1 exp = @top_expressions[0] return exp if exp.name == "process-definition" - return nil + nil end end end # @@ -400,17 +403,17 @@ # def OpenWFE.make_safe (method_name) method_name = OpenWFE::to_underscore(method_name) return "_" + method_name \ if KEYWORDS.include? eval(":"+method_name) - return method_name + method_name end def OpenWFE.to_expression_name (method_name) method_name = method_name.to_s method_name = method_name[1..-1] if method_name[0, 1] == "_" method_name = OpenWFE::to_dash(method_name) - return method_name + method_name end end