lib/openwfe/expressions/environment.rb in openwferu-0.9.12 vs lib/openwfe/expressions/environment.rb in openwferu-0.9.12.863
- old
+ new
@@ -27,13 +27,10 @@
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#++
-#
-# $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
-#
#
# "made in Japan"
#
# John Mettraux at openwfe.org
@@ -53,40 +50,54 @@
class Environment < FlowExpression
include Schedulable
names :environment
- attr_accessor \
- :variables
+ attr_accessor :variables
def initialize \
(fei, parent, environment_id, application_context, attributes)
super(fei, parent, environment_id, application_context, attributes)
@variables = {}
end
+ #
+ # Looks up for the value of a variable in this environment.
+ #
def [] (key)
value = @variables[key]
return value \
if @variables.has_key?(key) or is_engine_environment?
return get_parent[key] if @parent_id
- return get_expression_pool.fetch_engine_environment[key]
+ get_expression_pool.fetch_engine_environment[key]
end
+ #
+ # Binds a variable in this environment.
+ #
def []= (key, value)
+
+ #ldebug do
+ # "#{fei.to_debug_s} []= "+
+ # "'#{key}' => '#{value}' (#{value.class.name})"
+ #end
+
synchronize do
@variables[key] = value
store_itself()
end
end
+ #
+ # Removes a variable from this environment.
+ #
def delete (key)
synchronize do
@variables.delete key
store_itself()