Class: Billy::Brain
- Inherits:
-
Object
- Object
- Billy::Brain
- Defined in:
- lib/billygoat/brain.rb
Instance Attribute Summary collapse
-
#skill ⇒ Object
Returns the value of attribute skill.
Attributes included from Skills
Attributes included from Credentials
Attributes included from Knowledge
Attributes included from Settings
Attributes included from Config
Instance Method Summary collapse
-
#execute(*args) ⇒ Object
Execute a task in memory.
-
#forget ⇒ Object
Clear the workspace for executing tasks.
-
#memory ⇒ Object
Short term memory serving as a workspace for executing tasks.
-
#recall(name) ⇒ Object
Recall a skill and place it in memory.
Methods included from Skills
#find_skill, #skills, #skills_dir, #skills_path, #system_skills_path
Methods included from Credentials
#credentials, #credentials_path, #save_credentials
Methods included from Knowledge
#default_knowledge, #knowledge, #knowledge_path, #save_knowledge, #update_knowledge, #validate_knowledge
Methods included from Settings
#default_settings, #save_settings, #settings_file, #settings_path
Methods included from Config
#config_path, #create_config_path, #save_configuration
Methods included from Disk
Instance Attribute Details
#skill ⇒ Object
Returns the value of attribute skill.
12 13 14 |
# File 'lib/billygoat/brain.rb', line 12 def skill @skill end |
Instance Method Details
#execute(*args) ⇒ Object
Execute a task in memory
48 49 50 51 52 53 54 55 56 |
# File 'lib/billygoat/brain.rb', line 48 def execute(*args) assert_skill_loaded if args.empty? || !skill.has_a_task?(args.first) args.unshift skill.default_task.name end memory.send *args end |
#forget ⇒ Object
Clear the workspace for executing tasks
30 31 32 |
# File 'lib/billygoat/brain.rb', line 30 def forget @memory = nil end |
#memory ⇒ Object
Short term memory serving as a workspace for executing tasks
18 19 20 21 22 23 24 25 |
# File 'lib/billygoat/brain.rb', line 18 def memory return @memory if @memory @memory = Memory.new @memory.brain = self @memory.credentials = credentials @memory.skills = skills @memory end |
#recall(name) ⇒ Object
Recall a skill and place it in memory
37 38 39 40 41 42 43 |
# File 'lib/billygoat/brain.rb', line 37 def recall(name) self.skill = find_skill(name) return unless skill require skill.internal_location if skill.internal_location memory.extend(skill.module) end |