summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/package.rb
diff options
context:
space:
mode:
authorrandym <[email protected]>2018-02-08 00:14:12 +0900
committerrandym <[email protected]>2018-02-08 00:14:12 +0900
commit747ff93269c518db21c9869b61b1d1470395b502 (patch)
tree16c8d9c416a02fc7ca8bd91e058ea61c72dfc7ce /lib/axlsx/package.rb
parent3f34514ecf53fb4a3401b5336833bbeb439efe2a (diff)
downloadcaxlsx-747ff93269c518db21c9869b61b1d1470395b502.tar.gz
caxlsx-747ff93269c518db21c9869b61b1d1470395b502.zip
chore(coverage) increase coverage and cleanup
Diffstat (limited to 'lib/axlsx/package.rb')
-rw-r--r--lib/axlsx/package.rb17
1 files changed, 3 insertions, 14 deletions
diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb
index 5b5ea14a..da661b34 100644
--- a/lib/axlsx/package.rb
+++ b/lib/axlsx/package.rb
@@ -147,11 +147,7 @@ module Axlsx
errors = []
parts.each do |part|
unless part[:schema].nil?
- if part[:doc].is_a? String
- errors.concat validate_single_doc(part[:schema], part[:doc])
- else
- errors.concat validate_single_doc(part[:schema], part[:doc].to_xml_string)
- end
+ errors.concat validate_single_doc(part[:schema], part[:doc].to_xml_string)
end
end
errors
@@ -165,20 +161,13 @@ module Axlsx
def write_parts(zip)
p = parts
p.each do |part|
- #next unless part[:entry] == CORE_PN
unless part[:doc].nil?
zip.put_next_entry(zip_entry_for_part(part))
- if part[:doc].is_a? String
- entry = ['1.9.2', '1.9.3'].include?(RUBY_VERSION) ? part[:doc].force_encoding('BINARY') : part[:doc]
- zip.puts(entry)
- else
- part[:doc].to_xml_string(zip)
- end
+ part[:doc].to_xml_string(zip)
end
unless part[:path].nil?
zip.put_next_entry(zip_entry_for_part(part))
- # binread for 1.9.3
- zip.write IO.respond_to?(:binread) ? IO.binread(part[:path]) : IO.read(part[:path])
+ zip.write IO.read(part[:path])
end
end
zip