lib/adhearsion/voip/asterisk/config_generators/config_generator.rb in adhearsion-1.0.0 vs lib/adhearsion/voip/asterisk/config_generators/config_generator.rb in adhearsion-1.0.1

- old
+ new

@@ -9,12 +9,13 @@ class << self # Converts a config file into a Hash of contexts mapping to two dimensional array of pairs def create_sanitary_hash_from(config_file_content) almost_sanitized = Hash[*config_file_content. + split("\n"). # Split the lines into an Array grep(/^\s*[^;\s]/). # Grep lines that aren't commented out - join. # Convert them into one String again + join("\n"). # Convert them into one String again split(SECTION_TITLE). # Separate them into sections map(&:strip). # Remove all whitespace reject(&:empty?). # Get rid of indices that were only whitespace # Lastly, separate the keys/value pairs for the Hash map { |token| token =~ /^#{SECTION_TITLE}$/ ? token : token.split(/\n+/).sort } @@ -96,6 +97,6 @@ end end end end -end \ No newline at end of file +end