lib/qed/evaluator.rb in qed-2.1.0 vs lib/qed/evaluator.rb in qed-2.1.1
- old
+ new
@@ -17,14 +17,16 @@
#--
class Evaluator
#
def initialize(script, *observers)
- @script = script
- @file = script.file
- @scope = script.scope
- @root = script.root
+ @script = script
+ @file = script.file
+ @root = script.root
+ @scope = script.scope
+ @binding = script.binding
+ @advice = script.advice
@observers = observers
end
#
@@ -62,11 +64,11 @@
#
def tag_pre(element)
advise!(:before_code, element, @file)
begin
- eval(element.text, @scope.__binding__, @file, element.line)
+ eval(element.text, @binding, @file, element.line)
pass!(element)
rescue Assertion => exception
fail!(element, exception)
rescue Exception => exception
error!(element, exception)
@@ -102,23 +104,25 @@
end
#
def import!(file)
advise!(:unload)
- eval(File.read(file), @scope.__binding__, file)
+ eval(File.read(file), @binding, file)
advise!(:load, file)
end
#
def advise!(signal, *args)
@observers.each{ |o| o.update(signal, *args) }
- @scope.__advice__.call(signal, *args)
+ #@scope.__advice__.call(signal, *args)
+ @advice.call(signal, *args)
end
#
#def advise_when!(match)
- # @scope.__advice__.call_when(match)
+ # @advice.call_when(match)
#end
end
end
+