Class: Adhearsion::Asterisk::ConfigGenerator::Queues
- Inherits:
-
Adhearsion::Asterisk::ConfigGenerator
- Object
- Adhearsion::Asterisk::ConfigGenerator
- Adhearsion::Asterisk::ConfigGenerator::Queues
- Defined in:
- lib/adhearsion/asterisk/config_generator/queues.rb
Overview
This will generate a queues.conf file. If there is no documentation on what a method actually does, take a look at the documentation for its original key/value pair in an unedited queues.conf file. WARNING! Don't get too embedded with these method names. I'm still not satisfied. These settings will be greatly abstracted eventually.
Defined Under Namespace
Classes: QueueDefinition
Constant Summary
- DEFAULT_GENERAL_SECTION =
{ :autofill => "yes" }
Constants inherited from Adhearsion::Asterisk::ConfigGenerator
Instance Attribute Summary (collapse)
-
- (Object) general_section
readonly
Returns the value of attribute general_section.
-
- (Object) properties
readonly
Returns the value of attribute properties.
-
- (Object) queue_definitions
readonly
Returns the value of attribute queue_definitions.
Instance Method Summary (collapse)
-
- (Queues) initialize
constructor
A new instance of Queues.
- - (Object) monitor_type(symbol)
- - (Object) persistent_members(yes_no)
- - (Object) queue(name) {|new_queue| ... }
- - (Object) to_s (also: #conf)
Methods inherited from Adhearsion::Asterisk::ConfigGenerator
create_sanitary_hash_from, #to_sanitary_hash, warning_message
Constructor Details
- (Queues) initialize
A new instance of Queues
17 18 19 20 21 22 |
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 17 def initialize @general_section = DEFAULT_GENERAL_SECTION.clone @properties = {} @queue_definitions = [] super end |
Instance Attribute Details
- (Object) general_section (readonly)
Returns the value of attribute general_section
16 17 18 |
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 16 def general_section @general_section end |
- (Object) properties (readonly)
Returns the value of attribute properties
16 17 18 |
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 16 def properties @properties end |
- (Object) queue_definitions (readonly)
Returns the value of attribute queue_definitions
16 17 18 |
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 16 def queue_definitions @queue_definitions end |
Instance Method Details
- (Object) monitor_type(symbol)
42 43 44 45 |
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 42 def monitor_type(symbol) criteria = {:monitor => "Monitor", :mix_monitor => "MixMonitor"} one_of_and_translate criteria, 'monitor-type' => symbol, :with => general_section end |
- (Object) persistent_members(yes_no)
38 39 40 |
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 38 def persistent_members(yes_no) boolean :persistentmembers => yes_no, :with => general_section end |
- (Object) queue(name) {|new_queue| ... }
24 25 26 27 28 29 |
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 24 def queue(name) new_queue = QueueDefinition.new name yield new_queue if block_given? queue_definitions << new_queue new_queue end |
- (Object) to_s Also known as: conf
31 32 33 34 35 |
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 31 def to_s ConfigGenerator. + general_section.inject("[general]") { |section,(key,value)| section + "\n#{key}=#{value}" } + "\n\n" + queue_definitions.map(&:to_s).join("\n\n") end |