lib/adhearsion/voip/freeswitch/basic_connection_manager.rb in adhearsion-0.8.6 vs lib/adhearsion/voip/freeswitch/basic_connection_manager.rb in adhearsion-1.0.0
- old
+ new
@@ -16,11 +16,11 @@
def get_header
separate_pairs get_raw_header
end
def get_raw_header
- (returning [] do |lines|
+ ([].tap do |lines|
until line = @io.gets and line.chomp.empty?
lines << line.chomp
end
end) * "\n"
end
@@ -32,10 +32,10 @@
separate_pairs @io.read(length)
end
def separate_pairs(lines)
lines.inject({}) do |h,line|
- returning h do |hash|
+ h.tap do |hash|
k,v = line.split(/\s*:\s*/)
hash[k] = URI.unescape(v).strip if k && v
end
end
end