From e86e052a713b3d08645080c5742a8885ce1f274d Mon Sep 17 00:00:00 2001 From: "Umar M. Sheikh" Date: Tue, 4 Feb 2014 15:25:31 +0500 Subject: [PATCH] remove the run method as it is no longer needed, and redo explanation --- app/models/agents/code_agent.rb | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/app/models/agents/code_agent.rb b/app/models/agents/code_agent.rb index c3abfeda..35feb99b 100644 --- a/app/models/agents/code_agent.rb +++ b/app/models/agents/code_agent.rb @@ -12,18 +12,11 @@ module Agents You can create events based on your own logic. Specifically, you have the following class, lets say, present is a string "js_code". - function Agent(m, e, o, agent){ - this.memory = JSON.parse(m); + function Agent(e, o, agent){ this.events = JSON.parse(e); this.options = JSON.parse(o); this.agent = JSON.parse(agent); } - Agent.prototype.run = function(){ - //Implement me - // Example create a new event with the following code: - //var new_event = JSON.stringify({key1: "val1", key2: "val2"}); - //create_event(pd); - } Agent.prototype.check = function(){ // Implement me } @@ -62,8 +55,6 @@ module Agents return JSON.stringify(mem); } } - Agent.prototype.run = function(){ - } Agent.prototype.check = function(){ } Agent.prototype.receive = function(){ @@ -106,10 +97,11 @@ module Agents end def default_options - js_code = "Agent.prototype.run = function(){ var pd = JSON.stringify({memory: this.memory(), events: this.events, options: this.options});create_event(pd); };Agent.prototype.check = function(){ var pd = JSON.stringify({memory: this.memory(), events: this.events, options: this.options});create_event(pd); };Agent.prototype.receive = function(){ var pd = JSON.stringify({memory: this.memory(), events: this.events, options: this.options});create_event(pd); }" + js_code = "Agent.prototype.check = function(){ var pd = JSON.stringify({memory: this.memory(), events: this.events, options: this.options});create_event(pd); };Agent.prototype.receive = function(){ var pd = JSON.stringify({memory: this.memory(), events: this.events, options: this.options});create_event(pd); }" { "code" => js_code, - 'expected_receive_period_in_days' => "2" + 'expected_receive_period_in_days' => "2", + 'expected_update_period_in_days' => "2" } end end