module Adhearsion
This is largely based on the Daemonize library by Travis Whitton and Judson Lester. grub.ath.cx/daemonize. I cleaned it up a bit to meet Adhearsion's quality standards.
Constants
- Error
- VERSION
Public Class Methods
active_calls()
click to toggle source
# File lib/adhearsion.rb, line 82 def active_calls @active_calls ||= Calls.new end
ahn_root=(path)
click to toggle source
@deprecated Use root= instead
# File lib/adhearsion.rb, line 35 def ahn_root=(path) Adhearsion.deprecated "#Adhearsion.root=" Adhearsion.root = path end
config() { |config| ... }
click to toggle source
# File lib/adhearsion.rb, line 40 def config(&block) @config ||= initialize_config block_given? and yield @config @config end
config=(config)
click to toggle source
# File lib/adhearsion.rb, line 70 def config=(config) @config = config end
deprecated(new_method)
click to toggle source
# File lib/adhearsion.rb, line 46 def deprecated(new_method) logger.info "#{caller[0]} - This method is deprecated, please use #{new_method}." logger.warn caller.join("\n") end
environment()
click to toggle source
# File lib/adhearsion.rb, line 62 def environment ENV['AHN_ENV'] || ENV['RAILS_ENV'] || :development end
environments()
click to toggle source
# File lib/adhearsion.rb, line 66 def environments config.valid_environments end
initialize_config()
click to toggle source
# File lib/adhearsion.rb, line 51 def initialize_config _config = Configuration.new env = environment.to_sym if environment.respond_to? :to_sym unless _config.valid_environment? env puts "You tried to initialize with an invalid environment name #{env}; environment-specific config may not load successfully. Valid values are #{_config.valid_environments}." env = nil end _config.platform.environment = env if env _config end
root()
click to toggle source
Returns the current application path @return [Pathname] The application path
# File lib/adhearsion.rb, line 28 def root Adhearsion.config[:platform].root end
root=(path)
click to toggle source
Sets the application path @param The application path to set
# File lib/adhearsion.rb, line 20 def root=(path) Adhearsion.config[:platform].root = path.nil? ? nil : File.expand_path(path) end
router(&block)
click to toggle source
# File lib/adhearsion.rb, line 74 def router(&block) @router ||= Router.new(&block || Proc.new {}) end
router=(other)
click to toggle source
# File lib/adhearsion.rb, line 78 def router=(other) @router = other end
statistics()
click to toggle source
@return [Adhearsion::Statistics] a statistics aggregator object capable of producing stats dumps
# File lib/adhearsion.rb, line 88 def statistics unless Celluloid::Actor[:statistics] Statistics.supervise_as :statistics Statistics.setup_event_handlers end Celluloid::Actor[:statistics] end
status()
click to toggle source
# File lib/adhearsion.rb, line 96 def status Adhearsion::Process.state_name end