class Billy::Brain
Attributes
skill[RW]
Public Instance Methods
execute(*args)
click to toggle source
Execute a task in memory
# 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()
click to toggle source
Clear the workspace for executing tasks
# File lib/billygoat/brain.rb, line 30 def forget @memory = nil end
memory()
click to toggle source
Short term memory serving as a workspace for executing tasks
# 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)
click to toggle source
Recall a skill and place it in memory
# 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
Private Instance Methods
assert_skill_loaded()
click to toggle source
# File lib/billygoat/brain.rb, line 60 def assert_skill_loaded fail "Naaaa! Unknown skill" unless skill end