Module: Talks::Hooks

Defined in:
lib/talks/hooks.rb

Class Method Summary collapse

Class Method Details

.create(args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/talks/hooks.rb', line 5

def create(args)
  engine = Talks.config.engine
  options, args = shift_options(args.dup)
  command_name = command args
  voice, before_message, after_message, before_notify, after_notify = \
    parse options, command_name

  before_hook = hook(engine, voice, before_message)
  after_hook = hook(engine, voice, after_message)
  command = args.join(' ')

  [before_notify, [before_hook, command, after_hook].join('; '), after_notify]
end