Sha256: 0e16118631c2b4951554424bae0b131ea9c8701200c9e6a5b869dcae6ca91cb2
Contents?: true
Size: 1.75 KB
Versions: 1
Compression:
Stored size: 1.75 KB
Contents
require 'pry' module Adhearsion module Console include Adhearsion class << self ## # Start the Adhearsion console # def run Pry.prompt = [ proc do |*args| obj, nest_level, pry_instance = args "AHN#{' ' * nest_level}> " end, proc do |*args| obj, nest_level, pry_instance = args "AHN#{' ' * nest_level}? " end ] Pry.config.command_prefix = "%" if libedit? logger.error "Cannot start. You are running Adhearsion on Ruby with libedit. You must use readline for the console to work." else logger.info "Starting up..." pry end end def calls Adhearsion.active_calls end def use(call) unless call.is_a? Adhearsion::Call raise ArgumentError unless Adhearsion.active_calls[call] call = Adhearsion.active_calls[call] end Pry.prompt = [ proc { "AHN<#{call.channel}> " }, proc { "AHN<#{call.channel}? " } ] # Pause execution of the thread currently controlling the call call.with_command_lock do CallWrapper.new(call).pry end end def libedit? begin # If NotImplemented then this might be libedit Readline.emacs_editing_mode false rescue NotImplementedError true end end end class CallWrapper attr_accessor :call def initialize(call) @call = call extend Adhearsion::Commands.for('asterisk') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
adhearsion-2.0.0.alpha1 | lib/adhearsion/console.rb |