lib/openwfe/expressions/environment.rb in openwferu-0.9.7 vs lib/openwfe/expressions/environment.rb in openwferu-0.9.8
- old
+ new
@@ -46,11 +46,11 @@
module OpenWFE
#
# An environment is a store for variables.
- # It's an expression as it's storable in the expression pool.
+ # It's an expression thus it's storable in the expression pool.
#
class Environment < FlowExpression
include Schedulable
names :environment
@@ -66,61 +66,33 @@
@variables = {}
end
def [] (key)
- #if OpenWFE::starts_with(key, "//")
- # return get_expression_pool()\
- # .get_engine_environment()[key[2..-1]]
- #end
- #if OpenWFE::starts_with(key, "/")
- # return get_root_environment()[key[1..-1]]
- #end
-
value = @variables[key]
return value \
if @variables.has_key?(key) or is_engine_environment?
- #if value or is_engine_environment?
return get_parent[key] if @parent_id
return get_expression_pool.fetch_engine_environment[key]
end
def []= (key, value)
+ synchronize do
- #if OpenWFE::starts_with(key, "//")
- # key = key[2..-1]
- # get_expression_pool().fetch_engine_environment()[key] = value
- #elsif OpenWFE::starts_with(key, "/")
- # key = key[1..-1]
- # get_root_environment()[key] = value
- #else
- # @variables[key] = value
- # store_itself()
- # #ldebug { "[]= #{@fei.to_debug_s} : '#{key}' -> '#{value}'" }
- #end
-
- @variables[key] = value
- store_itself()
+ @variables[key] = value
+ store_itself()
+ end
end
def delete (key)
+ synchronize do
- #if OpenWFE::starts_with(key, "//")
- # key = key[2..-1]
- # get_expression_pool().fetch_engine_environment().delete(key)
- #elsif OpenWFE::starts_with(key, "/")
- # key = key[1..-1]
- # get_root_environment().delete(key)
- #else
- # @variables.delete(key)
- # store_itself()
- #end
-
- @variables.delete key
- store_itself()
+ @variables.delete key
+ store_itself()
+ end
end
#
# This method is usually called before the environment gets wiped
# out of the expression pool.