lib/delorean/engine.rb in delorean_lang-0.3.38 vs lib/delorean/engine.rb in delorean_lang-0.4.00
- old
+ new
@@ -346,11 +346,11 @@
# Runtime
######################################################################
def evaluate(node, attrs, params={})
raise "bad params" unless params.is_a?(Hash)
-
+
if node.is_a?(Class)
klass = node
else
raise "bad node '#{node}'" unless node =~ /^[A-Z][a-zA-Z0-9_]*$/
@@ -363,10 +363,10 @@
params[:_engine] = self
type_arr = attrs.is_a?(Array)
attrs = [attrs] unless type_arr
-
+
res = attrs.map { |attr|
raise "bad attribute '#{attr}'" unless attr =~ /^[a-z][A-Za-z0-9_]*$/
klass.send("#{attr}#{POST}".to_sym, params)
}
type_arr ? res : res[0]