Permalink
Browse files

remove the run method as it is no longer needed, and redo explanation

  • Loading branch information...
1 parent c2e2704 commit e86e052a713b3d08645080c5742a8885ce1f274d @umarsheikh umarsheikh committed Feb 4, 2014
Showing with 4 additions and 12 deletions.
  1. +4 −12 app/models/agents/code_agent.rb
View
16 app/models/agents/code_agent.rb
@@ -12,18 +12,11 @@ class CodeAgent < Agent
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 @@ def example_js
return JSON.stringify(mem);
}
}
- Agent.prototype.run = function(){
- }
Agent.prototype.check = function(){
}
Agent.prototype.receive = function(){
@@ -106,10 +97,11 @@ def receive(incoming_events)
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

0 comments on commit e86e052

Please sign in to comment.