Class: Ellen::Robot

Inherits:
Object
  • Object
show all
Includes:
Mem
Defined in:
lib/ellen/robot.rb

Constant Summary collapse

DEFAULT_ROBOT_NAME =
"ellen"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Robot

Returns a new instance of Robot.



11
12
13
# File 'lib/ellen/robot.rb', line 11

def initialize(options)
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



9
10
11
# File 'lib/ellen/robot.rb', line 9

def options
  @options
end

Instance Method Details

#nameObject



30
31
32
# File 'lib/ellen/robot.rb', line 30

def name
  ENV["ROBOT_NAME"] || DEFAULT_ROBOT_NAME
end

#receive(attributes) ⇒ Object



23
24
25
26
27
28
# File 'lib/ellen/robot.rb', line 23

def receive(attributes)
  message = Message.new(attributes)
  handlers.each do |handler|
    handler.call(message)
  end
end

#runObject



15
16
17
18
19
20
21
# File 'lib/ellen/robot.rb', line 15

def run
  dotenv
  bundle
  setup
  validate
  adapt
end