28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/zephyr.rb', line 28
def each_capitalized
respond_to?(:enum_for) and (block_given? or return enum_for(__method__))
@header.each do |k,v|
base_length = "#{k}: \r\n".length
values = v.map { |i| i.to_s.split(', ') }.flatten
while !values.empty?
current_line = ""
while values.first && current_line.length + base_length + values.first.length + 2 < 8192
val = values.shift.strip
current_line += current_line.empty? ? val : ", #{val}"
end
yield capitalize(k), current_line
end
end
end
|