lib/openwfe/expressions/expressionmap.rb in openwferu-0.9.15 vs lib/openwfe/expressions/expressionmap.rb in openwferu-0.9.16

- old
+ new

@@ -77,10 +77,11 @@ def initialize () super @expressions = {} + @ancestors = {} register DefineExpression register SequenceExpression register ParticipantExpression @@ -109,10 +110,11 @@ register ReserveExpression register RevalExpression register PrintExpression + register LogExpression register LoseExpression register ForgetExpression register CursorExpression @@ -202,9 +204,21 @@ expression_class.expression_names.each do |name| name = OpenWFE::to_dash(name) @expressions[name] = expression_class end + expression_class.ancestors.each do |ancestor| + (@ancestors[ancestor] ||= []) << expression_class + end + end + + # + # Returns an array of expression classes that have the given + # class/module among their ancestors. + # + def get_expression_classes (ancestor) + + @ancestors[ancestor] end def to_s s = "" @expressions.keys.sort.each do |name|