Class: Adhearsion::VoIP::Asterisk::ConfigFileGenerators::Queues
- Inherits:
-
AsteriskConfigGenerator
- Object
- AsteriskConfigGenerator
- Adhearsion::VoIP::Asterisk::ConfigFileGenerators::Queues
- Defined in:
- lib/adhearsion/voip/asterisk/config_generators/queues.conf.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 collapse
- DEFAULT_GENERAL_SECTION =
{ :autofill => "yes" }
Constants inherited from AsteriskConfigGenerator
AsteriskConfigGenerator::SECTION_TITLE
Instance Attribute Summary collapse
-
#general_section ⇒ Object
readonly
Returns the value of attribute general_section.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#queue_definitions ⇒ Object
readonly
Returns the value of attribute queue_definitions.
Instance Method Summary collapse
-
#initialize ⇒ Queues
constructor
A new instance of Queues.
- #monitor_type(symbol) ⇒ Object
- #persistent_members(yes_no) ⇒ Object
- #queue(name) {|new_queue| ... } ⇒ Object
- #to_s ⇒ Object (also: #conf)
Methods inherited from AsteriskConfigGenerator
create_sanitary_hash_from, #to_sanitary_hash, warning_message
Constructor Details
#initialize ⇒ Queues
Returns a new instance of Queues.
19 20 21 22 23 24 |
# File 'lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb', line 19 def initialize @general_section = DEFAULT_GENERAL_SECTION.clone @properties = {} @queue_definitions = [] super end |
Instance Attribute Details
#general_section ⇒ Object (readonly)
Returns the value of attribute general_section.
18 19 20 |
# File 'lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb', line 18 def general_section @general_section end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
18 19 20 |
# File 'lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb', line 18 def properties @properties end |
#queue_definitions ⇒ Object (readonly)
Returns the value of attribute queue_definitions.
18 19 20 |
# File 'lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb', line 18 def queue_definitions @queue_definitions end |
Instance Method Details
#monitor_type(symbol) ⇒ Object
44 45 46 47 |
# File 'lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb', line 44 def monitor_type(symbol) criteria = {:monitor => "Monitor", :mix_monitor => "MixMonitor"} one_of_and_translate criteria, 'monitor-type' => symbol, :with => general_section end |
#persistent_members(yes_no) ⇒ Object
40 41 42 |
# File 'lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb', line 40 def persistent_members(yes_no) boolean :persistentmembers => yes_no, :with => general_section end |
#queue(name) {|new_queue| ... } ⇒ Object
26 27 28 29 30 31 |
# File 'lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb', line 26 def queue(name) new_queue = QueueDefinition.new name yield new_queue if block_given? queue_definitions << new_queue new_queue end |
#to_s ⇒ Object Also known as: conf
33 34 35 36 37 |
# File 'lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb', line 33 def to_s AsteriskConfigGenerator. + general_section.inject("[general]") { |section,(key,value)| section + "\n#{key}=#{value}" } + "\n\n" + queue_definitions.map(&:to_s).join("\n\n") end |