lib/openwfe/expressions/raw_prog.rb in openwferu-0.9.15 vs lib/openwfe/expressions/raw_prog.rb in openwferu-0.9.16
- old
+ new
@@ -105,14 +105,18 @@
string_child = nil
attributes = OpenWFE::SymbolHash.new
#puts " ... params.class is #{params.class}"
- if params.kind_of? Hash
+ if params.kind_of?(Hash)
params.each do |k, v|
- #attributes[k.to_s] = v.to_s
- attributes[OpenWFE::symbol_to_name(k.to_s)] = v.to_s
+ if k == '0'
+ string_child = v.to_s
+ else
+ #attributes[OpenWFE::symbol_to_name(k.to_s)] = v.to_s
+ attributes[OpenWFE::symbol_to_name(k.to_s)] = v
+ end
end
elsif params
string_child = params.to_s
end
@@ -221,13 +225,14 @@
protected
def ProcessDefinition.pack_args (args)
return args[0] if args.length == 1
+
a = {}
args.each_with_index do |arg, index|
- if arg.is_a? Hash
+ if arg.is_a?(Hash)
a = a.merge(arg)
break
end
a[index.to_s] = arg
end
@@ -252,10 +257,11 @@
return s[0..-11] if s.match(".*Definition$")
s
end
def ProcessDefinition.as_revision (s)
+
s.gsub("_", ".")
end
class Context
@@ -328,10 +334,11 @@
end
protected
def extract_attributes ()
+
raw_representation.attributes
end
def extract_descriptions ()
@@ -354,11 +361,11 @@
i = 0
result = []
raw_representation.children.each do |child|
- if child.kind_of? SimpleExpRepresentation
+ if child.kind_of?(SimpleExpRepresentation)
cname = child.name.intern
next if cname == :param
next if cname == :parameter
@@ -371,11 +378,11 @@
efei = @environment_id
rawexp = ProgRawExpression\
.new(cfei, @fei, efei, @application_context, child)
- get_expression_pool.update(rawexp)
+ get_expression_pool.update rawexp
i = i + 1
result << rawexp.fei
else
@@ -385,24 +392,25 @@
end
result
end
def extract_text_children ()
+
raw_representation.children.collect do |child|
- next if child.is_a? SimpleExpRepresentation
+ next if child.is_a?(SimpleExpRepresentation)
child.to_s
end
end
def extract_parameters ()
r = []
raw_representation.children.each do |child|
- next unless child.is_a? SimpleExpRepresentation
+ next unless child.is_a?(SimpleExpRepresentation)
- name = child.name.intern
+ name = child.name.to_sym
next unless (name == :parameter or name == :param)
r << Parameter.new(
child.attributes[:field],
child.attributes[:match],
@@ -423,9 +431,10 @@
# 'undo' isn't reserved by Ruby, but lets keep it in line
# with 'do' and 'redo' that are.
#
KEYWORDS = [
:if, :do, :redo, :undo, :print, :sleep, :loop, :break, :when
+ #:until, :while
]
#
# Ensures the method name is not conflicting with Ruby keywords
# and turn dashes to underscores.