Class: Ellen::Robot
Constant Summary collapse
- DEFAULT_ROBOT_NAME =
"ellen"
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #brain ⇒ Object
-
#initialize(options = {}) ⇒ Robot
constructor
A new instance of Robot.
- #name ⇒ Object
- #receive(attributes) ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Robot
Returns a new instance of Robot.
11 12 13 |
# File 'lib/ellen/robot.rb', line 11 def initialize( = {}) @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/ellen/robot.rb', line 9 def @options end |
Instance Method Details
#brain ⇒ Object
35 36 37 |
# File 'lib/ellen/robot.rb', line 35 def brain Brains::Base.find_class.new end |
#name ⇒ Object
31 32 33 |
# File 'lib/ellen/robot.rb', line 31 def name ENV["ROBOT_NAME"] || DEFAULT_ROBOT_NAME end |
#receive(attributes) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/ellen/robot.rb', line 24 def receive(attributes) = Message.new(attributes.merge(robot: self)) handlers.each do |handler| handler.call() end end |
#run ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/ellen/robot.rb', line 15 def run dotenv bundle setup remember handle adapt end |