Class: Qbot::Adapter::Driver

Inherits:
Object
  • Object
show all
Defined in:
lib/qbot/adapter.rb

Direct Known Subclasses

Mattermost, Shell, Slack

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.buildObject



15
16
17
# File 'lib/qbot/adapter.rb', line 15

def build
  @target.new
end

.inherited(subclass) ⇒ Object



11
12
13
# File 'lib/qbot/adapter.rb', line 11

def inherited(subclass)
  @target = subclass
end

Instance Method Details

#listen(&block) ⇒ Object



27
28
29
# File 'lib/qbot/adapter.rb', line 27

def listen(&block)
  raise 'Not implemented'
end

#post(text, **options) ⇒ Object



31
32
33
# File 'lib/qbot/adapter.rb', line 31

def post(text, **options)
  raise 'Not implemented'
end

#reply_to(message, text, **options) ⇒ Object



35
36
37
# File 'lib/qbot/adapter.rb', line 35

def reply_to(message, text, **options)
  raise 'Not implemented'
end

#run(bots) ⇒ Object



21
22
23
24
25
# File 'lib/qbot/adapter.rb', line 21

def run(bots)
  listen do |message|
    bots.each { |bot| bot.call(message.dup) }
  end
end