lib/openwfe/expressions/expressionmap.rb in openwferu-0.9.2 vs lib/openwfe/expressions/expressionmap.rb in openwferu-0.9.3
- old
+ new
@@ -38,10 +38,11 @@
#
# John Mettraux at openwfe.org
#
require 'openwfe/service'
+require 'openwfe/expressions/environment'
require 'openwfe/expressions/fe_define'
require 'openwfe/expressions/fe_misc'
require 'openwfe/expressions/fe_value'
require 'openwfe/expressions/fe_sequence'
require 'openwfe/expressions/fe_subprocess'
@@ -111,10 +112,14 @@
@map["quote"] = FqvExpression
@map["variable"] = FqvExpression
@map["f"] = FqvExpression
@map["q"] = FqvExpression
@map["v"] = FqvExpression
+
+ @map["environment"] = Environment
+ #
+ # only used by get_expression_names()
end
#
# Returns the expression class corresponding to the given
# expression name
@@ -144,9 +149,21 @@
#
def expression_names
return @map.keys
end
+ #
+ # Returns an array of expression names whose class are assignable
+ # from the given expression_class.
+ #
+ def get_expression_names (expression_class)
+ names = []
+ @map.each do |name, exp_class|
+ names << name \
+ if exp_class.ancestors.include? expression_class
+ end
+ return names
+ end
end
end