summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/package.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/axlsx/package.rb')
-rw-r--r--lib/axlsx/package.rb88
1 files changed, 44 insertions, 44 deletions
diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb
index 20195ddc..26f838f8 100644
--- a/lib/axlsx/package.rb
+++ b/lib/axlsx/package.rb
@@ -216,56 +216,56 @@ module Axlsx
# @private
def parts
parts = [
- { :entry => "xl/#{STYLES_PN}", :doc => workbook.styles, :schema => SML_XSD },
- { :entry => CORE_PN, :doc => @core, :schema => CORE_XSD },
- { :entry => APP_PN, :doc => @app, :schema => APP_XSD },
- { :entry => WORKBOOK_RELS_PN, :doc => workbook.relationships, :schema => RELS_XSD },
- { :entry => WORKBOOK_PN, :doc => workbook, :schema => SML_XSD }
+ { entry: "xl/#{STYLES_PN}", doc: workbook.styles, schema: SML_XSD },
+ { entry: CORE_PN, doc: @core, schema: CORE_XSD },
+ { entry: APP_PN, doc: @app, schema: APP_XSD },
+ { entry: WORKBOOK_RELS_PN, doc: workbook.relationships, schema: RELS_XSD },
+ { entry: WORKBOOK_PN, doc: workbook, schema: SML_XSD }
]
workbook.drawings.each do |drawing|
- parts << { :entry => "xl/#{drawing.rels_pn}", :doc => drawing.relationships, :schema => RELS_XSD }
- parts << { :entry => "xl/#{drawing.pn}", :doc => drawing, :schema => DRAWING_XSD }
+ parts << { entry: "xl/#{drawing.rels_pn}", doc: drawing.relationships, schema: RELS_XSD }
+ parts << { entry: "xl/#{drawing.pn}", doc: drawing, schema: DRAWING_XSD }
end
workbook.tables.each do |table|
- parts << { :entry => "xl/#{table.pn}", :doc => table, :schema => SML_XSD }
+ parts << { entry: "xl/#{table.pn}", doc: table, schema: SML_XSD }
end
workbook.pivot_tables.each do |pivot_table|
cache_definition = pivot_table.cache_definition
- parts << { :entry => "xl/#{pivot_table.rels_pn}", :doc => pivot_table.relationships, :schema => RELS_XSD }
- parts << { :entry => "xl/#{pivot_table.pn}", :doc => pivot_table } # , :schema => SML_XSD}
- parts << { :entry => "xl/#{cache_definition.pn}", :doc => cache_definition } # , :schema => SML_XSD}
+ parts << { entry: "xl/#{pivot_table.rels_pn}", doc: pivot_table.relationships, schema: RELS_XSD }
+ parts << { entry: "xl/#{pivot_table.pn}", doc: pivot_table } # , :schema => SML_XSD}
+ parts << { entry: "xl/#{cache_definition.pn}", doc: cache_definition } # , :schema => SML_XSD}
end
workbook.comments.each do |comment|
unless comment.empty?
- parts << { :entry => "xl/#{comment.pn}", :doc => comment, :schema => SML_XSD }
- parts << { :entry => "xl/#{comment.vml_drawing.pn}", :doc => comment.vml_drawing, :schema => nil }
+ parts << { entry: "xl/#{comment.pn}", doc: comment, schema: SML_XSD }
+ parts << { entry: "xl/#{comment.vml_drawing.pn}", doc: comment.vml_drawing, schema: nil }
end
end
workbook.charts.each do |chart|
- parts << { :entry => "xl/#{chart.pn}", :doc => chart, :schema => DRAWING_XSD }
+ parts << { entry: "xl/#{chart.pn}", doc: chart, schema: DRAWING_XSD }
end
workbook.images.each do |image|
- parts << { :entry => "xl/#{image.pn}", :path => image.image_src } unless image.remote?
+ parts << { entry: "xl/#{image.pn}", path: image.image_src } unless image.remote?
end
if use_shared_strings
- parts << { :entry => "xl/#{SHARED_STRINGS_PN}", :doc => workbook.shared_strings, :schema => SML_XSD }
+ parts << { entry: "xl/#{SHARED_STRINGS_PN}", doc: workbook.shared_strings, schema: SML_XSD }
end
workbook.worksheets.each do |sheet|
- parts << { :entry => "xl/#{sheet.rels_pn}", :doc => sheet.relationships, :schema => RELS_XSD }
- parts << { :entry => "xl/#{sheet.pn}", :doc => sheet, :schema => SML_XSD }
+ parts << { entry: "xl/#{sheet.rels_pn}", doc: sheet.relationships, schema: RELS_XSD }
+ parts << { entry: "xl/#{sheet.pn}", doc: sheet, schema: SML_XSD }
end
# Sort parts for correct MIME detection
[
- { :entry => CONTENT_TYPES_PN, :doc => content_types, :schema => CONTENT_TYPES_XSD },
- { :entry => RELS_PN, :doc => relationships, :schema => RELS_XSD },
+ { entry: CONTENT_TYPES_PN, doc: content_types, schema: CONTENT_TYPES_XSD },
+ { entry: RELS_PN, doc: relationships, schema: RELS_XSD },
*(parts.sort_by { |part| part[:entry] }.reverse)
]
end
@@ -292,41 +292,41 @@ module Axlsx
def content_types
c_types = base_content_types
workbook.drawings.each do |drawing|
- c_types << Axlsx::Override.new(:PartName => "/xl/#{drawing.pn}",
- :ContentType => DRAWING_CT)
+ c_types << Axlsx::Override.new(PartName: "/xl/#{drawing.pn}",
+ ContentType: DRAWING_CT)
end
workbook.charts.each do |chart|
- c_types << Axlsx::Override.new(:PartName => "/xl/#{chart.pn}",
- :ContentType => CHART_CT)
+ c_types << Axlsx::Override.new(PartName: "/xl/#{chart.pn}",
+ ContentType: CHART_CT)
end
workbook.tables.each do |table|
- c_types << Axlsx::Override.new(:PartName => "/xl/#{table.pn}",
- :ContentType => TABLE_CT)
+ c_types << Axlsx::Override.new(PartName: "/xl/#{table.pn}",
+ ContentType: TABLE_CT)
end
workbook.pivot_tables.each do |pivot_table|
- c_types << Axlsx::Override.new(:PartName => "/xl/#{pivot_table.pn}",
- :ContentType => PIVOT_TABLE_CT)
- c_types << Axlsx::Override.new(:PartName => "/xl/#{pivot_table.cache_definition.pn}",
- :ContentType => PIVOT_TABLE_CACHE_DEFINITION_CT)
+ c_types << Axlsx::Override.new(PartName: "/xl/#{pivot_table.pn}",
+ ContentType: PIVOT_TABLE_CT)
+ c_types << Axlsx::Override.new(PartName: "/xl/#{pivot_table.cache_definition.pn}",
+ ContentType: PIVOT_TABLE_CACHE_DEFINITION_CT)
end
workbook.comments.each do |comment|
unless comment.empty?
- c_types << Axlsx::Override.new(:PartName => "/xl/#{comment.pn}",
- :ContentType => COMMENT_CT)
+ c_types << Axlsx::Override.new(PartName: "/xl/#{comment.pn}",
+ ContentType: COMMENT_CT)
end
end
unless workbook.comments.empty?
- c_types << Axlsx::Default.new(:Extension => "vml", :ContentType => VML_DRAWING_CT)
+ c_types << Axlsx::Default.new(Extension: "vml", ContentType: VML_DRAWING_CT)
end
workbook.worksheets.each do |sheet|
- c_types << Axlsx::Override.new(:PartName => "/xl/#{sheet.pn}",
- :ContentType => WORKSHEET_CT)
+ c_types << Axlsx::Override.new(PartName: "/xl/#{sheet.pn}",
+ ContentType: WORKSHEET_CT)
end
exts = workbook.images.map { |image| image.extname.downcase }
exts.uniq.each do |ext|
@@ -337,11 +337,11 @@ module Axlsx
elsif ext == PNG_EX
PNG_CT
end
- c_types << Axlsx::Default.new(:ContentType => ct, :Extension => ext)
+ c_types << Axlsx::Default.new(ContentType: ct, Extension: ext)
end
if use_shared_strings
- c_types << Axlsx::Override.new(:PartName => "/xl/#{SHARED_STRINGS_PN}",
- :ContentType => SHARED_STRINGS_CT)
+ c_types << Axlsx::Override.new(PartName: "/xl/#{SHARED_STRINGS_PN}",
+ ContentType: SHARED_STRINGS_CT)
end
c_types
end
@@ -351,12 +351,12 @@ module Axlsx
# @private
def base_content_types
c_types = ContentType.new
- c_types << Default.new(:ContentType => RELS_CT, :Extension => RELS_EX)
- c_types << Default.new(:Extension => XML_EX, :ContentType => XML_CT)
- c_types << Override.new(:PartName => "/#{APP_PN}", :ContentType => APP_CT)
- c_types << Override.new(:PartName => "/#{CORE_PN}", :ContentType => CORE_CT)
- c_types << Override.new(:PartName => "/xl/#{STYLES_PN}", :ContentType => STYLES_CT)
- c_types << Axlsx::Override.new(:PartName => "/#{WORKBOOK_PN}", :ContentType => WORKBOOK_CT)
+ c_types << Default.new(ContentType: RELS_CT, Extension: RELS_EX)
+ c_types << Default.new(Extension: XML_EX, ContentType: XML_CT)
+ c_types << Override.new(PartName: "/#{APP_PN}", ContentType: APP_CT)
+ c_types << Override.new(PartName: "/#{CORE_PN}", ContentType: CORE_CT)
+ c_types << Override.new(PartName: "/xl/#{STYLES_PN}", ContentType: STYLES_CT)
+ c_types << Axlsx::Override.new(PartName: "/#{WORKBOOK_PN}", ContentType: WORKBOOK_CT)
c_types.lock
c_types
end