Class: Adhearsion::VoIP::DSL::Dialplan::EventCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/adhearsion/voip/dsl/dialplan/dispatcher.rb

Overview

Instantiated and returned in every dialplan command

Direct Known Subclasses

ExitingEventCommand, NoOpEventCommand

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, *args, &block) ⇒ EventCommand

Returns a new instance of EventCommand.



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/adhearsion/voip/dsl/dialplan/dispatcher.rb', line 21

def initialize(app, *args, &block)
  @hash = args.pop if args.last.kind_of?(Hash)
  @app, @args = app, args

  if @hash
    @returns = @hash[:returns] || :raw
    @on_keypress = @hash[:on_keypress]
  end

  @response_block = block if block_given?
end

Instance Attribute Details

#appObject

Returns the value of attribute app.



19
20
21
# File 'lib/adhearsion/voip/dsl/dialplan/dispatcher.rb', line 19

def app
  @app
end

#argsObject

Returns the value of attribute args.



19
20
21
# File 'lib/adhearsion/voip/dsl/dialplan/dispatcher.rb', line 19

def args
  @args
end

#on_keypress(&block) ⇒ Object

Returns the value of attribute on_keypress.



19
20
21
# File 'lib/adhearsion/voip/dsl/dialplan/dispatcher.rb', line 19

def on_keypress
  @on_keypress
end

#response_blockObject

Returns the value of attribute response_block.



19
20
21
# File 'lib/adhearsion/voip/dsl/dialplan/dispatcher.rb', line 19

def response_block
  @response_block
end

#returnsObject

Returns the value of attribute returns.



19
20
21
# File 'lib/adhearsion/voip/dsl/dialplan/dispatcher.rb', line 19

def returns
  @returns
end

Instance Method Details

#on_break(&block) ⇒ Object



37
38
39
# File 'lib/adhearsion/voip/dsl/dialplan/dispatcher.rb', line 37

def on_break(&block)
  block_given? ? @on_break = block : @on_break
end