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

- old
+ new

@@ -57,13 +57,13 @@ attr_accessor \ :variables def initialize \ - (id, parent, environment_id, application_context, attributes) + (fei, parent, environment_id, application_context, attributes) - super(id, parent, environment_id, application_context, attributes) + super(fei, parent, environment_id, application_context, attributes) @variables = {} end def [] (key) @@ -145,17 +145,39 @@ store_itself() end # - # Returns the top environment for the process instance. + # Returns the top environment for the process instance (the + # environment just before the engine environment). # - def get_root_environment () + def get_root_environment + #ldebug { "get_root_environment\n#{self}" } + return self if not @parent_id + get_parent.get_root_environment + end - #ldebug { "get_root_environment()\n#{self}" } + #def get_subprocess_environment + # return self if not @parent_id + # return self if @parent_id.sub_instance_id != @fei.sub_instance_id + # get_parent.get_subprocess_environment + #end - return self if not @parent_id - return get_parent().get_root_environment() + # + # Returns a deep copy of this environment. + # + def dup + + env = Environment.new( + @fei.dup, + @parent_id, + @environment_id, + @application_context, + OpenWFE::fulldup(@attributes)) + + env.variables = OpenWFE::fulldup self.variables + + env end end end