lib/delorean/base.rb in delorean_lang-1.0.0 vs lib/delorean/base.rb in delorean_lang-1.1.0

- old
+ new

@@ -171,11 +171,11 @@ NodeCall.new(_e, engine, node || self, params) end ###################################################################### - def self._instance_call(obj, method, args, _e) + def self._instance_call(obj, method, args, _e, &block) begin msg = method.to_sym rescue NoMethodError raise "bad method #{method}" end @@ -191,17 +191,25 @@ end raise "no such method #{method}" unless matcher if matcher.match_to? - return( - _instance_call(obj, matcher.match_to, args, _e) - ) + if block + return( + _instance_call(obj, matcher.match_to, args, _e, &block) + ) + else + return( + _instance_call(obj, matcher.match_to, args, _e) + ) + end end matcher.match!(klass: klass, args: args) - obj.public_send(msg, *args) + return obj.public_send(msg, *args) unless block + + obj.public_send(msg, *args, &block) end ###################################################################### end end