lib/adhearsion/voip/asterisk/config_manager.rb in adhearsion-1.0.3 vs lib/adhearsion/voip/asterisk/config_manager.rb in adhearsion-1.1.0
- old
+ new
@@ -37,12 +37,14 @@
end
private
def read_configuration
- normalized_file = self.class.normalize_configuration execute(read_command)
- normalized_file.split(/^\[([-_\w]+)\]$/)[1..-1].each_slice(2).map do |(name,properties)|
+ normalized_file = self.class.normalize_configuration File.open(@filename, 'r'){|f| f.read}
+ sections = normalized_file.split(/^\[([-_\w]+)\]$/)[1..-1]
+ return [] if sections.nil?
+ sections.each_slice(2).map do |(name,properties)|
[name, hash_from_properties(properties)]
end
end
def hash_from_properties(properties)
@@ -51,18 +53,9 @@
next property_hash unless name && value
property_hash[name] = value
property_hash
end
end
-
- def execute(command)
- %x[command]
- end
-
- def read_command
- "cat #{filename}"
- end
-
end
end
end
end