lib/kumogata/client.rb in kumogata-0.1.5 vs lib/kumogata/client.rb in kumogata-0.1.6
- old
+ new
@@ -178,20 +178,26 @@
@__refs__ = nil
data = data.flatten.select {|i| not i.nil? }
if options[:strip]
+ prev_not_str = false
+
data = data.map do |item|
if item.kind_of?(String)
- item.split("\n").map {|i| i.gsub(/\A\s+/, "") }.join("\n")
+ item = item.split("\n").map {|i| i.gsub(/\A\s+/, "") }.join("\n")
+ item = " " + item if prev_not_str
+ prev_not_str = false
+ item
else
+ prev_not_str = true
item
end
end
end
- if data.last.kind_of?(String) and data.last == ""
- data.last << "\n"
+ if data.last.kind_of?(String) and data.last.strip == ""
+ data.last.replace("\n")
end
unless data.last.kind_of?(String) and data.last =~ /\n\Z/
data << "\n"
end