lib/write_xlsx/package/app.rb in write_xlsx-1.09.4 vs lib/write_xlsx/package/app.rb in write_xlsx-1.09.5
- old
+ new
@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
+
require 'write_xlsx/package/xml_writer_simple'
require 'write_xlsx/utility'
module Writexlsx
module Package
class App
-
include Writexlsx::Utility
attr_writer :doc_security
def initialize(workbook)
@writer = Package::XMLWriterSimple.new
@@ -43,41 +43,39 @@
def add_worksheet_heading_pairs
add_heading_pair(
[
'Worksheets',
- @workbook.worksheets.reject {|s| s.is_chartsheet?}.count
+ @workbook.worksheets.reject { |s| s.is_chartsheet? }.count
]
)
end
def add_chartsheet_heading_pairs
add_heading_pair(['Charts', @workbook.chartsheet_count])
end
def add_worksheet_part_names
- @workbook.worksheets.
- reject { |sheet| sheet.is_chartsheet? }.
- each { |sheet| add_part_name(sheet.name) }
+ @workbook.worksheets
+ .reject { |sheet| sheet.is_chartsheet? }
+ .each { |sheet| add_part_name(sheet.name) }
end
def add_chartsheet_part_names
- @workbook.worksheets.
- select { |sheet| sheet.is_chartsheet? }.
- each { |sheet| add_part_name(sheet.name) }
+ @workbook.worksheets
+ .select { |sheet| sheet.is_chartsheet? }
+ .each { |sheet| add_part_name(sheet.name) }
end
def add_part_name(part_name)
@part_names.push(part_name)
end
def add_named_range_heading_pairs
range_count = @workbook.named_ranges.size
- if range_count != 0
- add_heading_pair([ 'Named Ranges', range_count ])
- end
+ add_heading_pair(['Named Ranges', range_count]) if range_count != 0
end
def add_named_ranges_parts
@workbook.named_ranges.each { |named_range| add_part_name(named_range) }
end
@@ -98,19 +96,17 @@
private
#
# Write the <Properties> element.
#
- def write_properties
- tag = 'Properties'
-
- schema = 'http://schemas.openxmlformats.org/officeDocument/2006/'
+ def write_properties(&block)
+ schema = 'http://schemas.openxmlformats.org/officeDocument/2006/'
attributes = [
['xmlns', "#{schema}extended-properties"],
['xmlns:vt', "#{schema}docPropsVTypes"]
]
- @writer.tag_elements('Properties', attributes) { yield }
+ @writer.tag_elements('Properties', attributes, &block)
end
#
# Write the <Application> element.
#