From e7e3b852c5e3200c10fab3f24128587bbd929845 Mon Sep 17 00:00:00 2001 From: "Umar M. Sheikh" Date: Fri, 31 Jan 2014 17:41:37 +0500 Subject: [PATCH] remove testing code, no need to now pass memory as parameter, see prev commit --- app/models/agents/code_agent.rb | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/app/models/agents/code_agent.rb b/app/models/agents/code_agent.rb index e09bd156..c9b84565 100644 --- a/app/models/agents/code_agent.rb +++ b/app/models/agents/code_agent.rb @@ -67,19 +67,7 @@ module Agents end true end - def setter_and_getter_memory(incoming_events = "") - context = V8::Context.new - context.eval(example_js) - context["create_event"] = lambda {|x,y| puts x; puts y; create_event payload: JSON.parse(y)} - context["access_memory"] = lambda {|a, x, y| x && y ? (memory[x] = y; memory.to_json) : memory.to_json } - context.eval(options['code']) # should override the run function. - a, e, o = [self.attributes.to_json, incoming_events.to_json, self.options.to_json] - string = "a = new Agent('#{e}','#{o}','#{a}');" - context.eval(string) - binding.pry - context.eval("a.memory()") - end def execute_js(incoming_events) context = V8::Context.new context.eval(example_js) @@ -90,9 +78,9 @@ module Agents a, e, o = [self.attributes.to_json, incoming_events.to_json, self.options.to_json] string = "a = new Agent('#{e}','#{o}','#{a}');" context.eval(string) - context.eval("a.memory('5','6')") # set memory for testing context.eval("a.run();") end + def check execute_js("") end