summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-04-08 11:53:12 +0200
committerGeremia Taglialatela <[email protected]>2023-04-08 11:53:12 +0200
commit55526805cf28cc91a22df5811b26cd23bdefa8d3 (patch)
tree2cbc6403b385078b0ed5e275c49f0c60522bdd16 /lib
parentacf00d356494ef504c3de0e4a0db6b25f2bd7636 (diff)
downloadcaxlsx-55526805cf28cc91a22df5811b26cd23bdefa8d3.tar.gz
caxlsx-55526805cf28cc91a22df5811b26cd23bdefa8d3.zip
Fix space-related offenses
- Layout/SpaceAfterComma - Layout/SpaceAroundEqualsInParameterDefault - Layout/SpaceAroundOperators - Layout/SpaceBeforeBlockBraces - Layout/SpaceInsideBlockBraces - Layout/SpaceInsideHashLiteralBraces - Layout/SpaceInsideParens
Diffstat (limited to 'lib')
-rw-r--r--lib/axlsx.rb10
-rw-r--r--lib/axlsx/content_type/abstract_content_type.rb2
-rw-r--r--lib/axlsx/content_type/default.rb2
-rw-r--r--lib/axlsx/doc_props/app.rb2
-rw-r--r--lib/axlsx/doc_props/core.rb2
-rw-r--r--lib/axlsx/drawing/area_chart.rb4
-rw-r--r--lib/axlsx/drawing/area_series.rb2
-rw-r--r--lib/axlsx/drawing/ax_data_source.rb2
-rw-r--r--lib/axlsx/drawing/axes.rb2
-rw-r--r--lib/axlsx/drawing/axis.rb6
-rw-r--r--lib/axlsx/drawing/bar_3D_chart.rb8
-rw-r--r--lib/axlsx/drawing/bar_chart.rb6
-rw-r--r--lib/axlsx/drawing/bar_series.rb4
-rw-r--r--lib/axlsx/drawing/bubble_chart.rb2
-rw-r--r--lib/axlsx/drawing/bubble_series.rb6
-rw-r--r--lib/axlsx/drawing/cat_axis.rb2
-rw-r--r--lib/axlsx/drawing/chart.rb12
-rw-r--r--lib/axlsx/drawing/d_lbls.rb4
-rw-r--r--lib/axlsx/drawing/drawing.rb8
-rw-r--r--lib/axlsx/drawing/hyperlink.rb4
-rw-r--r--lib/axlsx/drawing/line_3D_chart.rb6
-rw-r--r--lib/axlsx/drawing/line_chart.rb4
-rw-r--r--lib/axlsx/drawing/line_series.rb2
-rw-r--r--lib/axlsx/drawing/marker.rb6
-rw-r--r--lib/axlsx/drawing/num_data.rb6
-rw-r--r--lib/axlsx/drawing/num_data_source.rb4
-rw-r--r--lib/axlsx/drawing/num_val.rb2
-rw-r--r--lib/axlsx/drawing/one_cell_anchor.rb6
-rw-r--r--lib/axlsx/drawing/pic.rb10
-rw-r--r--lib/axlsx/drawing/picture_locking.rb2
-rw-r--r--lib/axlsx/drawing/pie_3D_chart.rb4
-rw-r--r--lib/axlsx/drawing/pie_series.rb2
-rw-r--r--lib/axlsx/drawing/scaling.rb4
-rw-r--r--lib/axlsx/drawing/scatter_chart.rb2
-rw-r--r--lib/axlsx/drawing/scatter_series.rb4
-rw-r--r--lib/axlsx/drawing/ser_axis.rb2
-rw-r--r--lib/axlsx/drawing/series.rb2
-rw-r--r--lib/axlsx/drawing/str_data.rb4
-rw-r--r--lib/axlsx/drawing/str_val.rb2
-rw-r--r--lib/axlsx/drawing/title.rb2
-rw-r--r--lib/axlsx/drawing/two_cell_anchor.rb10
-rw-r--r--lib/axlsx/drawing/val_axis.rb2
-rw-r--r--lib/axlsx/drawing/view_3D.rb4
-rw-r--r--lib/axlsx/drawing/vml_drawing.rb2
-rw-r--r--lib/axlsx/drawing/vml_shape.rb6
-rw-r--r--lib/axlsx/package.rb42
-rw-r--r--lib/axlsx/rels/relationship.rb10
-rw-r--r--lib/axlsx/rels/relationships.rb4
-rw-r--r--lib/axlsx/stylesheet/border.rb2
-rw-r--r--lib/axlsx/stylesheet/border_pr.rb2
-rw-r--r--lib/axlsx/stylesheet/cell_alignment.rb2
-rw-r--r--lib/axlsx/stylesheet/cell_protection.rb2
-rw-r--r--lib/axlsx/stylesheet/cell_style.rb2
-rw-r--r--lib/axlsx/stylesheet/color.rb2
-rw-r--r--lib/axlsx/stylesheet/dxf.rb2
-rw-r--r--lib/axlsx/stylesheet/font.rb6
-rw-r--r--lib/axlsx/stylesheet/gradient_fill.rb4
-rw-r--r--lib/axlsx/stylesheet/gradient_stop.rb4
-rw-r--r--lib/axlsx/stylesheet/num_fmt.rb2
-rw-r--r--lib/axlsx/stylesheet/pattern_fill.rb6
-rw-r--r--lib/axlsx/stylesheet/styles.rb56
-rw-r--r--lib/axlsx/stylesheet/table_style.rb10
-rw-r--r--lib/axlsx/stylesheet/table_style_element.rb2
-rw-r--r--lib/axlsx/stylesheet/table_styles.rb4
-rw-r--r--lib/axlsx/stylesheet/xf.rb2
-rw-r--r--lib/axlsx/util/constants.rb2
-rw-r--r--lib/axlsx/util/options_parser.rb2
-rw-r--r--lib/axlsx/util/serialized_attributes.rb2
-rw-r--r--lib/axlsx/util/simple_typed_list.rb6
-rw-r--r--lib/axlsx/util/storage.rb14
-rw-r--r--lib/axlsx/util/validators.rb2
-rw-r--r--lib/axlsx/workbook/defined_name.rb4
-rw-r--r--lib/axlsx/workbook/shared_strings_table.rb6
-rw-r--r--lib/axlsx/workbook/workbook.rb20
-rw-r--r--lib/axlsx/workbook/workbook_view.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb6
-rw-r--r--lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb6
-rw-r--r--lib/axlsx/workbook/worksheet/auto_filter/filters.rb4
-rw-r--r--lib/axlsx/workbook/worksheet/border_creator.rb6
-rw-r--r--lib/axlsx/workbook/worksheet/break.rb4
-rw-r--r--lib/axlsx/workbook/worksheet/cell.rb6
-rw-r--r--lib/axlsx/workbook/worksheet/cell_serializer.rb20
-rw-r--r--lib/axlsx/workbook/worksheet/cfvo.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/cfvos.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/col.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/col_breaks.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/color_scale.rb16
-rw-r--r--lib/axlsx/workbook/worksheet/comment.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/comments.rb6
-rw-r--r--lib/axlsx/workbook/worksheet/conditional_formatting.rb4
-rw-r--r--lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb4
-rw-r--r--lib/axlsx/workbook/worksheet/data_bar.rb6
-rw-r--r--lib/axlsx/workbook/worksheet/data_validation.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/date_time_converter.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/icon_set.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/page_margins.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/page_set_up_pr.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/page_setup.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/pane.rb4
-rw-r--r--lib/axlsx/workbook/worksheet/pivot_table.rb16
-rw-r--r--lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb16
-rw-r--r--lib/axlsx/workbook/worksheet/pivot_tables.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/protected_range.rb4
-rw-r--r--lib/axlsx/workbook/worksheet/rich_text.rb8
-rw-r--r--lib/axlsx/workbook/worksheet/rich_text_run.rb6
-rw-r--r--lib/axlsx/workbook/worksheet/row.rb6
-rw-r--r--lib/axlsx/workbook/worksheet/row_breaks.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/selection.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/sheet_calc_pr.rb4
-rw-r--r--lib/axlsx/workbook/worksheet/sheet_format_pr.rb4
-rw-r--r--lib/axlsx/workbook/worksheet/sheet_pr.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/sheet_protection.rb4
-rw-r--r--lib/axlsx/workbook/worksheet/sheet_view.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/table.rb12
-rw-r--r--lib/axlsx/workbook/worksheet/tables.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet.rb42
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet_comments.rb4
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb6
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb2
119 files changed, 338 insertions, 338 deletions
diff --git a/lib/axlsx.rb b/lib/axlsx.rb
index 931feb2d..df847a18 100644
--- a/lib/axlsx.rb
+++ b/lib/axlsx.rb
@@ -54,7 +54,7 @@ module Axlsx
end
# determines the cell range for the items provided
- def self.cell_range(cells, absolute=true)
+ def self.cell_range(cells, absolute = true)
return "" unless cells.first.is_a? Cell
first_cell, last_cell = cells.minmax_by(&:pos)
@@ -88,7 +88,7 @@ module Axlsx
letters_str = name[/[A-Z]+/]
# capitalization?!?
- v = letters_str.reverse.chars.reduce({:base=>1, :i=>0}) do |val, c|
+ v = letters_str.reverse.chars.reduce({ :base => 1, :i => 0 }) do |val, c|
val[:i] += ((c.bytes.first - 64) * val[:base])
val[:base] *= 26
@@ -123,7 +123,7 @@ module Axlsx
# @example Relative Cell Reference
# ws.rows.first.cells.first.r #=> "A1"
def self.cell_r(c_index, r_index)
- col_ref(c_index) << (r_index+1).to_s
+ col_ref(c_index) << (r_index + 1).to_s
end
# Creates an array of individual cell references based on an excel reference range.
@@ -143,10 +143,10 @@ module Axlsx
# performs the increadible feat of changing snake_case to CamelCase
# @param [String] s The snake case string to camelize
# @return [String]
- def self.camel(s="", all_caps = true)
+ def self.camel(s = "", all_caps = true)
s = s.to_s
s = s.capitalize if all_caps
- s.gsub(/_(.)/){ $1.upcase }
+ s.gsub(/_(.)/) { $1.upcase }
end
# returns the provided string with all invalid control charaters
diff --git a/lib/axlsx/content_type/abstract_content_type.rb b/lib/axlsx/content_type/abstract_content_type.rb
index 73d8a678..023c9086 100644
--- a/lib/axlsx/content_type/abstract_content_type.rb
+++ b/lib/axlsx/content_type/abstract_content_type.rb
@@ -5,7 +5,7 @@ module Axlsx
# Initializes an abstract content type
# @see Default, Override
- def initialize(options={})
+ def initialize(options = {})
parse_options options
end
diff --git a/lib/axlsx/content_type/default.rb b/lib/axlsx/content_type/default.rb
index 691b7e87..d5901456 100644
--- a/lib/axlsx/content_type/default.rb
+++ b/lib/axlsx/content_type/default.rb
@@ -14,7 +14,7 @@ module Axlsx
alias :Extension= :extension=
# Serializes this object to xml
- def to_xml_string(str ='')
+ def to_xml_string(str = '')
super(NODE_NAME, str)
end
end
diff --git a/lib/axlsx/doc_props/app.rb b/lib/axlsx/doc_props/app.rb
index ed46cf56..965b34dc 100644
--- a/lib/axlsx/doc_props/app.rb
+++ b/lib/axlsx/doc_props/app.rb
@@ -33,7 +33,7 @@ module Axlsx
# @option options [String] application
# @option options [String] app_version
# @option options [Integer] doc_security
- def initialize(options={})
+ def initialize(options = {})
parse_options options
end
diff --git a/lib/axlsx/doc_props/core.rb b/lib/axlsx/doc_props/core.rb
index 279b7493..0f3b6333 100644
--- a/lib/axlsx/doc_props/core.rb
+++ b/lib/axlsx/doc_props/core.rb
@@ -6,7 +6,7 @@ module Axlsx
# Creates a new Core object.
# @option options [String] creator
# @option options [Time] created
- def initialize(options={})
+ def initialize(options = {})
@creator = options[:creator] || 'axlsx'
@created = options[:created]
end
diff --git a/lib/axlsx/drawing/area_chart.rb b/lib/axlsx/drawing/area_chart.rb
index 7e831447..0c5193c6 100644
--- a/lib/axlsx/drawing/area_chart.rb
+++ b/lib/axlsx/drawing/area_chart.rb
@@ -42,7 +42,7 @@ module Axlsx
# @option options [Boolean] show_legend
# @option options [Symbol] grouping
# @see Chart
- def initialize(frame, options={})
+ def initialize(frame, options = {})
@vary_colors = false
@grouping = :standard
super(frame, options)
@@ -63,7 +63,7 @@ module Axlsx
def node_name
path = self.class.to_s
if i = path.rindex('::')
- path = path[(i+2)..-1]
+ path = path[(i + 2)..-1]
end
path[0] = path[0].chr.downcase
path
diff --git a/lib/axlsx/drawing/area_series.rb b/lib/axlsx/drawing/area_series.rb
index fd3dd501..7995c5bc 100644
--- a/lib/axlsx/drawing/area_series.rb
+++ b/lib/axlsx/drawing/area_series.rb
@@ -33,7 +33,7 @@ module Axlsx
# @option options [Array, SimpleTypedList] data
# @option options [Array, SimpleTypedList] labels
# @param [Chart] chart
- def initialize(chart, options={})
+ def initialize(chart, options = {})
@show_marker = false
@marker_symbol = options[:marker_symbol] ? options[:marker_symbol] : :default
@smooth = false
diff --git a/lib/axlsx/drawing/ax_data_source.rb b/lib/axlsx/drawing/ax_data_source.rb
index 10eb6c5e..b8aafc5e 100644
--- a/lib/axlsx/drawing/ax_data_source.rb
+++ b/lib/axlsx/drawing/ax_data_source.rb
@@ -5,7 +5,7 @@ module Axlsx
# creates a new NumDataSource object
# @option options [Array] data An array of Cells or Numeric objects
# @option options [Symbol] tag_name see tag_name
- def initialize(options={})
+ def initialize(options = {})
@tag_name = :cat
@data_type = StrData
@ref_tag_name = :strRef
diff --git a/lib/axlsx/drawing/axes.rb b/lib/axlsx/drawing/axes.rb
index 146d566e..0e4403ab 100644
--- a/lib/axlsx/drawing/axes.rb
+++ b/lib/axlsx/drawing/axes.rb
@@ -6,7 +6,7 @@ module Axlsx
# should be an axis name like :val_axis and its value should be the
# class of the axis type to construct. The :cat_axis, if there is one,
# must come first (we assume a Ruby 1.9+ Hash or an OrderedHash).
- def initialize(options={})
+ def initialize(options = {})
raise(ArgumentError, "CatAxis must come first") if options.keys.include?(:cat_axis) && options.keys.first != :cat_axis
options.each do |name, axis_class|
add_axis(name, axis_class)
diff --git a/lib/axlsx/drawing/axis.rb b/lib/axlsx/drawing/axis.rb
index 6f65f147..89915b68 100644
--- a/lib/axlsx/drawing/axis.rb
+++ b/lib/axlsx/drawing/axis.rb
@@ -9,11 +9,11 @@ module Axlsx
# @option options [Symbol] crosses
# @option options [Symbol] tick_lbl_pos
# @raise [ArgumentError] If axi_id or cross_ax are not unsigned integers
- def initialize(options={})
- @id = rand(8 ** 8)
+ def initialize(options = {})
+ @id = rand(8**8)
@format_code = "General"
@delete = @label_rotation = 0
- @scaling = Scaling.new(:orientation=>:minMax)
+ @scaling = Scaling.new(:orientation => :minMax)
@title = @color = nil
self.ax_pos = :b
self.tick_lbl_pos = :nextTo
diff --git a/lib/axlsx/drawing/bar_3D_chart.rb b/lib/axlsx/drawing/bar_3D_chart.rb
index 1bb47da7..f8dca9ad 100644
--- a/lib/axlsx/drawing/bar_3D_chart.rb
+++ b/lib/axlsx/drawing/bar_3D_chart.rb
@@ -70,12 +70,12 @@ module Axlsx
# @option options [Integer] perspective
# @see Chart
# @see View3D
- def initialize(frame, options={})
+ def initialize(frame, options = {})
@vary_colors = true
@gap_width, @gap_depth, @shape = nil, nil, nil
super(frame, options)
@series_type = BarSeries
- @view_3D = View3D.new({:r_ang_ax=>1}.merge(options))
+ @view_3D = View3D.new({ :r_ang_ax => 1 }.merge(options))
@d_lbls = nil
end
@@ -97,14 +97,14 @@ module Axlsx
# space between bar or column clusters, as a percentage of the bar or column width.
def gap_width=(v)
RangeValidator.validate "Bar3DChart.gap_width", 0, 500, v
- @gap_width=(v)
+ @gap_width = (v)
end
alias :gapWidth= :gap_width=
# space between bar or column clusters, as a percentage of the bar or column width.
def gap_depth=(v)
RangeValidator.validate "Bar3DChart.gap_depth", 0, 500, v
- @gap_depth=(v)
+ @gap_depth = (v)
end
alias :gapDepth= :gap_depth=
diff --git a/lib/axlsx/drawing/bar_chart.rb b/lib/axlsx/drawing/bar_chart.rb
index 84b9faa1..51046533 100644
--- a/lib/axlsx/drawing/bar_chart.rb
+++ b/lib/axlsx/drawing/bar_chart.rb
@@ -63,7 +63,7 @@ module Axlsx
# @option options [String] gap_width
# @option options [Symbol] shape
# @see Chart
- def initialize(frame, options={})
+ def initialize(frame, options = {})
@vary_colors = true
@gap_width, @overlap, @shape = nil, nil, nil
super(frame, options)
@@ -89,13 +89,13 @@ module Axlsx
# space between bar or column clusters, as a percentage of the bar or column width.
def gap_width=(v)
RangeValidator.validate "BarChart.gap_width", 0, 500, v
- @gap_width=(v)
+ @gap_width = (v)
end
alias :gapWidth= :gap_width=
def overlap=(v)
RangeValidator.validate "BarChart.overlap", -100, 100, v
- @overlap=(v)
+ @overlap = (v)
end
# The shape of the bars or columns
diff --git a/lib/axlsx/drawing/bar_series.rb b/lib/axlsx/drawing/bar_series.rb
index fcf7d98f..0b4d9614 100644
--- a/lib/axlsx/drawing/bar_series.rb
+++ b/lib/axlsx/drawing/bar_series.rb
@@ -32,11 +32,11 @@ module Axlsx
# @option options [String] colors an array of colors to use when rendering each data point
# @option options [String] series_color a color to use when rendering series
# @param [Chart] chart
- def initialize(chart, options={})
+ def initialize(chart, options = {})
@shape = :box
@colors = []
super(chart, options)
- self.labels = AxDataSource.new({:data => options[:labels]}) unless options[:labels].nil?
+ self.labels = AxDataSource.new({ :data => options[:labels] }) unless options[:labels].nil?
self.data = NumDataSource.new(options) unless options[:data].nil?
end
diff --git a/lib/axlsx/drawing/bubble_chart.rb b/lib/axlsx/drawing/bubble_chart.rb
index 9d0f3ff1..edd1a9b5 100644
--- a/lib/axlsx/drawing/bubble_chart.rb
+++ b/lib/axlsx/drawing/bubble_chart.rb
@@ -21,7 +21,7 @@ module Axlsx
alias :yValAxis :y_val_axis
# Creates a new bubble chart
- def initialize(frame, options={})
+ def initialize(frame, options = {})
@vary_colors = 0
super(frame, options)
diff --git a/lib/axlsx/drawing/bubble_series.rb b/lib/axlsx/drawing/bubble_series.rb
index 7d6e7bf6..78b44bf1 100644
--- a/lib/axlsx/drawing/bubble_series.rb
+++ b/lib/axlsx/drawing/bubble_series.rb
@@ -23,12 +23,12 @@ module Axlsx
attr_reader :color
# Creates a new BubbleSeries
- def initialize(chart, options={})
+ def initialize(chart, options = {})
@xData, @yData, @bubbleSize = nil
super(chart, options)
@xData = AxDataSource.new(:tag_name => :xVal, :data => options[:xData]) unless options[:xData].nil?
- @yData = NumDataSource.new({:tag_name => :yVal, :data => options[:yData]}) unless options[:yData].nil?
- @bubbleSize = NumDataSource.new({:tag_name => :bubbleSize, :data => options[:bubbleSize]}) unless options[:bubbleSize].nil?
+ @yData = NumDataSource.new({ :tag_name => :yVal, :data => options[:yData] }) unless options[:yData].nil?
+ @bubbleSize = NumDataSource.new({ :tag_name => :bubbleSize, :data => options[:bubbleSize] }) unless options[:bubbleSize].nil?
end
# @see color
diff --git a/lib/axlsx/drawing/cat_axis.rb b/lib/axlsx/drawing/cat_axis.rb
index 925d6ad6..ded05ee8 100644
--- a/lib/axlsx/drawing/cat_axis.rb
+++ b/lib/axlsx/drawing/cat_axis.rb
@@ -4,7 +4,7 @@ module Axlsx
# Creates a new CatAxis object
# @option options [Integer] tick_lbl_skip
# @option options [Integer] tick_mark_skip
- def initialize(options={})
+ def initialize(options = {})
@tick_lbl_skip = 1
@tick_mark_skip = 1
self.auto = 1
diff --git a/lib/axlsx/drawing/chart.rb b/lib/axlsx/drawing/chart.rb
index 49c72b58..e64163d9 100644
--- a/lib/axlsx/drawing/chart.rb
+++ b/lib/axlsx/drawing/chart.rb
@@ -13,10 +13,10 @@ module Axlsx
# @option options [Array|String|Cell] end_at The X, Y coordinates defining the bottom right corner of the chart.
# @option options [Boolean] plot_visible_only (true) Whether only data from visible cells should be plotted.
# @option options [Boolean] rounded_corners (true) Whether the chart area shall have rounded corners.
- def initialize(frame, options={})
+ def initialize(frame, options = {})
@style = 18
@view_3D = nil
- @graphic_frame=frame
+ @graphic_frame = frame
@graphic_frame.anchor.drawing.worksheet.workbook.charts << self
@series = SimpleTypedList.new Series
@show_legend = true
@@ -122,7 +122,7 @@ module Axlsx
# The part name for this chart
# @return [String]
def pn
- "#{CHART_PN % (index+1)}"
+ "#{CHART_PN % (index + 1)}"
end
# The title object for the chart.
@@ -178,7 +178,7 @@ module Axlsx
# Adds a new series to the chart's series collection.
# @return [Series]
# @see Series
- def add_series(options={})
+ def add_series(options = {})
@series_type.new(self, options)
@series.last
end
@@ -272,7 +272,7 @@ module Axlsx
# reference or cell to use in setting the start marker position.
# @param [Integer] y The row
# @return [Marker]
- def start_at(x=0, y=0)
+ def start_at(x = 0, y = 0)
@graphic_frame.anchor.start_at(x, y)
end
@@ -283,7 +283,7 @@ module Axlsx
# @param [Integer] y The row - default 10
# @return [Marker]
# @see start_at
- def end_at(x=10, y=10)
+ def end_at(x = 10, y = 10)
@graphic_frame.anchor.end_at(x, y)
end
diff --git a/lib/axlsx/drawing/d_lbls.rb b/lib/axlsx/drawing/d_lbls.rb
index fe204ddc..d997d9a9 100644
--- a/lib/axlsx/drawing/d_lbls.rb
+++ b/lib/axlsx/drawing/d_lbls.rb
@@ -8,7 +8,7 @@ module Axlsx
include Axlsx::Accessors
include Axlsx::OptionsParser
# creates a new DLbls object
- def initialize(chart_type, options={})
+ def initialize(chart_type, options = {})
raise ArgumentError, 'chart_type must inherit from Chart' unless [Chart, LineChart].include?(chart_type.superclass)
@chart_type = chart_type
initialize_defaults
@@ -72,7 +72,7 @@ module Axlsx
instance_vals = Axlsx.instance_values_for(self)
%w(d_lbl_pos show_legend_key show_val show_cat_name show_ser_name show_percent show_bubble_size show_leader_lines).each do |key|
next unless instance_vals.keys.include?(key) && instance_vals[key] != nil
- str << "<c:#{Axlsx::camel(key, false)} val='#{instance_vals[key]}' />"
+ str << "<c:#{Axlsx::camel(key, false)} val='#{instance_vals[key]}' />"
end
str << '</c:dLbls>'
end
diff --git a/lib/axlsx/drawing/drawing.rb b/lib/axlsx/drawing/drawing.rb
index 0de5dc15..bc6dd1cf 100644
--- a/lib/axlsx/drawing/drawing.rb
+++ b/lib/axlsx/drawing/drawing.rb
@@ -79,7 +79,7 @@ module Axlsx
# @note The recommended way to manage images is to use Worksheet.add_image. Please refer to that method for documentation.
# @see Worksheet#add_image
# @return [Pic]
- def add_image(options={})
+ def add_image(options = {})
if options[:end_at]
TwoCellAnchor.new(self, options).add_pic(options)
else
@@ -91,7 +91,7 @@ module Axlsx
# Adds a chart to the drawing.
# @note The recommended way to manage charts is to use Worksheet.add_chart. Please refer to that method for documentation.
# @see Worksheet#add_chart
- def add_chart(chart_type, options={})
+ def add_chart(chart_type, options = {})
TwoCellAnchor.new(self, options)
@anchors.last.add_chart(chart_type, options)
end
@@ -126,14 +126,14 @@ module Axlsx
# The part name for this drawing
# @return [String]
def pn
- "#{DRAWING_PN % (index+1)}"
+ "#{DRAWING_PN % (index + 1)}"
end
# The relational part name for this drawing
# #NOTE This should be rewritten to return an Axlsx::Relationship object.
# @return [String]
def rels_pn
- "#{DRAWING_RELS_PN % (index+1)}"
+ "#{DRAWING_RELS_PN % (index + 1)}"
end
# A list of objects this drawing holds.
diff --git a/lib/axlsx/drawing/hyperlink.rb b/lib/axlsx/drawing/hyperlink.rb
index 9ff9ee4a..979fdd6a 100644
--- a/lib/axlsx/drawing/hyperlink.rb
+++ b/lib/axlsx/drawing/hyperlink.rb
@@ -17,7 +17,7 @@ module Axlsx
# @option options [Boolean] endSnd terminate any sound events when processing this link
# @option options [Boolean] history include this link in the list of visited links for the applications history.
# @option options [Boolean] highlightClick indicate that the link has already been visited.
- def initialize(parent, options={})
+ def initialize(parent, options = {})
DataTypeValidator.validate "Hyperlink.parent", [Pic], parent
@parent = parent
parse_options options
@@ -91,7 +91,7 @@ module Axlsx
# @param [String] str
# @return [String]
def to_xml_string(str = '')
- serialized_tag 'a:hlinkClick', str, {:'r:id' => relationship.Id, :'xmlns:r' => XML_NS_R }
+ serialized_tag 'a:hlinkClick', str, { :'r:id' => relationship.Id, :'xmlns:r' => XML_NS_R }
end
end
end
diff --git a/lib/axlsx/drawing/line_3D_chart.rb b/lib/axlsx/drawing/line_3D_chart.rb
index da62851f..d45a417f 100644
--- a/lib/axlsx/drawing/line_3D_chart.rb
+++ b/lib/axlsx/drawing/line_3D_chart.rb
@@ -38,9 +38,9 @@ module Axlsx
# @see Chart
# @see lineChart
# @see View3D
- def initialize(frame, options={})
+ def initialize(frame, options = {})
@gap_depth = nil
- @view_3D = View3D.new({:r_ang_ax=>1}.merge(options))
+ @view_3D = View3D.new({ :r_ang_ax => 1 }.merge(options))
super(frame, options)
axes.add_axis :ser_axis, SerAxis
end
@@ -48,7 +48,7 @@ module Axlsx
# @see gapDepth
def gap_depth=(v)
RegexValidator.validate "Line3DChart.gapWidth", GAP_AMOUNT_PERCENT, v
- @gap_depth=(v)
+ @gap_depth = (v)
end
alias :gapDepth= :gap_depth=
diff --git a/lib/axlsx/drawing/line_chart.rb b/lib/axlsx/drawing/line_chart.rb
index a1734dea..1ff2bde5 100644
--- a/lib/axlsx/drawing/line_chart.rb
+++ b/lib/axlsx/drawing/line_chart.rb
@@ -42,7 +42,7 @@ module Axlsx
# @option options [Boolean] show_legend
# @option options [Symbol] grouping
# @see Chart
- def initialize(frame, options={})
+ def initialize(frame, options = {})
@vary_colors = false
@grouping = :standard
super(frame, options)
@@ -63,7 +63,7 @@ module Axlsx
def node_name
path = self.class.to_s
if i = path.rindex('::')
- path = path[(i+2)..-1]
+ path = path[(i + 2)..-1]
end
path[0] = path[0].chr.downcase
path
diff --git a/lib/axlsx/drawing/line_series.rb b/lib/axlsx/drawing/line_series.rb
index 2ef18484..18719277 100644
--- a/lib/axlsx/drawing/line_series.rb
+++ b/lib/axlsx/drawing/line_series.rb
@@ -33,7 +33,7 @@ module Axlsx
# @option options [Array, SimpleTypedList] data
# @option options [Array, SimpleTypedList] labels
# @param [Chart] chart
- def initialize(chart, options={})
+ def initialize(chart, options = {})
@show_marker = false
@marker_symbol = options[:marker_symbol] ? options[:marker_symbol] : :default
@smooth = false
diff --git a/lib/axlsx/drawing/marker.rb b/lib/axlsx/drawing/marker.rb
index 53a52dd1..a4933c33 100644
--- a/lib/axlsx/drawing/marker.rb
+++ b/lib/axlsx/drawing/marker.rb
@@ -10,7 +10,7 @@ module Axlsx
# @option options [Integer] colOff
# @option options [Integer] row
# @option options [Integer] rowOff
- def initialize(options={})
+ def initialize(options = {})
@col, @colOff, @row, @rowOff = 0, 0, 0, 0
parse_options options
end
@@ -45,7 +45,7 @@ module Axlsx
# or an Array.
# @param row the row of the marker. This is ignored if the col parameter is a Cell or
# String or Array.
- def coord(col, row=0)
+ def coord(col, row = 0)
coordinates = parse_coord_args(col, row)
self.col = coordinates[0]
self.row = coordinates[1]
@@ -64,7 +64,7 @@ module Axlsx
# handles multiple inputs for setting the position of a marker
# @see Chart#start_at
- def parse_coord_args(x, y=0)
+ def parse_coord_args(x, y = 0)
if x.is_a?(String)
x, y = *Axlsx::name_to_indices(x)
end
diff --git a/lib/axlsx/drawing/num_data.rb b/lib/axlsx/drawing/num_data.rb
index 9374dac3..140cfb9f 100644
--- a/lib/axlsx/drawing/num_data.rb
+++ b/lib/axlsx/drawing/num_data.rb
@@ -7,7 +7,7 @@ module Axlsx
# @option options [String] formatCode
# @option options [Array] :data
# @see StrData
- def initialize(options={})
+ def initialize(options = {})
@format_code = "General"
@pt = SimpleTypedList.new NumVal
parse_options options
@@ -19,7 +19,7 @@ module Axlsx
# Creates the val objects for this data set. I am not overly confident this is going to play nicely with time and data types.
# @param [Array] values An array of cells or values.
- def data=(values=[])
+ def data=(values = [])
@tag_name = values.first.is_a?(Cell) ? :numCache : :numLit
values.each do |value|
value = value.is_formula? ? 0 : value.value if value.is_a?(Cell)
@@ -28,7 +28,7 @@ module Axlsx
end
# @see format_code
- def format_code=(v='General')
+ def format_code=(v = 'General')
Axlsx::validate_string(v)
@format_code = v
end
diff --git a/lib/axlsx/drawing/num_data_source.rb b/lib/axlsx/drawing/num_data_source.rb
index bf5ad9ad..46f6ba71 100644
--- a/lib/axlsx/drawing/num_data_source.rb
+++ b/lib/axlsx/drawing/num_data_source.rb
@@ -6,7 +6,7 @@ module Axlsx
# creates a new NumDataSource object
# @option options [Array] data An array of Cells or Numeric objects
# @option options [Symbol] tag_name see tag_name
- def initialize(options={})
+ def initialize(options = {})
# override these three in child classes
@data_type ||= NumData
@tag_name ||= :val
@@ -42,7 +42,7 @@ module Axlsx
# serialize the object
# @param [String] str
- def to_xml_string(str="")
+ def to_xml_string(str = "")
str << ('<c:' << tag_name.to_s << '>')
if @f
str << ('<c:' << @ref_tag_name.to_s << '>')
diff --git a/lib/axlsx/drawing/num_val.rb b/lib/axlsx/drawing/num_val.rb
index 113fe865..c03a0fa1 100644
--- a/lib/axlsx/drawing/num_val.rb
+++ b/lib/axlsx/drawing/num_val.rb
@@ -9,7 +9,7 @@ module Axlsx
# creates a new NumVal object
# @option options [String] formatCode
# @option options [Integer] v
- def initialize(options={})
+ def initialize(options = {})
@format_code = "General"
super(options)
end
diff --git a/lib/axlsx/drawing/one_cell_anchor.rb b/lib/axlsx/drawing/one_cell_anchor.rb
index c17f4a25..52cf2244 100644
--- a/lib/axlsx/drawing/one_cell_anchor.rb
+++ b/lib/axlsx/drawing/one_cell_anchor.rb
@@ -14,7 +14,7 @@ module Axlsx
# @option options [String] image_src the file location of the image you will render
# @option options [String] name the name attribute for the rendered image
# @option options [String] descr the description of the image rendered
- def initialize(drawing, options={})
+ def initialize(drawing, options = {})
@drawing = drawing
@width = 0
@height = 0
@@ -52,7 +52,7 @@ module Axlsx
# We just 'figure it out' for you.
# @param [Array, String, Cell, Integer] x Accepts many inputs for defining the starting position of the cell.
# @param [Integer] y When x is an integer, this value is used for the row index at which the anchor starts.
- def start_at(x, y=0)
+ def start_at(x, y = 0)
from.coord x, y
end
@@ -91,7 +91,7 @@ module Axlsx
def ext
cy = @height * 914400 / 96
cx = @width * 914400 / 96
- {:cy=>cy, :cx=>cx}
+ { :cy => cy, :cx => cx }
end
end
end
diff --git a/lib/axlsx/drawing/pic.rb b/lib/axlsx/drawing/pic.rb
index 869dde4a..7d9cb532 100644
--- a/lib/axlsx/drawing/pic.rb
+++ b/lib/axlsx/drawing/pic.rb
@@ -14,7 +14,7 @@ module Axlsx
# @option options [Integer] :width
# @option options [Integer] :height
# @option options [Float] :opacity - set the picture opacity, accepts a value between 0.0 and 1.0
- def initialize(anchor, options={})
+ def initialize(anchor, options = {})
@anchor = anchor
@hyperlink = nil
@anchor.drawing.worksheet.workbook.images << self
@@ -57,7 +57,7 @@ module Axlsx
# sets or updates a hyperlink for this image.
# @param [String] v The href value for the hyper link
# @option options @see Hyperlink#initialize All options available to the Hyperlink class apply - however href will be overridden with the v parameter value.
- def hyperlink=(v, options={})
+ def hyperlink=(v, options = {})
options[:href] = v
if hyperlink.is_a?(Hyperlink)
options.each do |o|
@@ -103,7 +103,7 @@ module Axlsx
# The part name for this image used in serialization and relationship building
# @return [String]
def pn
- "#{IMAGE_PN % [(index+1), extname]}"
+ "#{IMAGE_PN % [(index + 1), extname]}"
end
# The relationship object for this pic.
@@ -145,7 +145,7 @@ module Axlsx
# @param [Integer] x The column
# @param [Integer] y The row
# @return [Marker]
- def start_at(x, y=nil)
+ def start_at(x, y = nil)
@anchor.start_at x, y
@anchor.from
end
@@ -154,7 +154,7 @@ module Axlsx
# @param [Integer] x The column
# @param [Integer] y The row
# @return [Marker]
- def end_at(x, y=nil)
+ def end_at(x, y = nil)
use_two_cell_anchor unless @anchor.is_a?(TwoCellAnchor)
@anchor.end_at x, y
@anchor.to
diff --git a/lib/axlsx/drawing/picture_locking.rb b/lib/axlsx/drawing/picture_locking.rb
index e230ec89..2e68a957 100644
--- a/lib/axlsx/drawing/picture_locking.rb
+++ b/lib/axlsx/drawing/picture_locking.rb
@@ -24,7 +24,7 @@ module Axlsx
# @option options [Boolean] noAdjustHandles
# @option options [Boolean] noChangeArrowheads
# @option options [Boolean] noChangeShapeType
- def initialize(options={})
+ def initialize(options = {})
@noChangeAspect = true
parse_options options
end
diff --git a/lib/axlsx/drawing/pie_3D_chart.rb b/lib/axlsx/drawing/pie_3D_chart.rb
index 5c2b57ac..1772c537 100644
--- a/lib/axlsx/drawing/pie_3D_chart.rb
+++ b/lib/axlsx/drawing/pie_3D_chart.rb
@@ -18,11 +18,11 @@ module Axlsx
# @option options [Integer] perspective
# @see Chart
# @see View3D
- def initialize(frame, options={})
+ def initialize(frame, options = {})
@vary_colors = true
super(frame, options)
@series_type = PieSeries
- @view_3D = View3D.new({:rot_x =>30, :perspective=>30}.merge(options))
+ @view_3D = View3D.new({ :rot_x => 30, :perspective => 30 }.merge(options))
@d_lbls = nil
end
diff --git a/lib/axlsx/drawing/pie_series.rb b/lib/axlsx/drawing/pie_series.rb
index 4c1b37fb..29b71e36 100644
--- a/lib/axlsx/drawing/pie_series.rb
+++ b/lib/axlsx/drawing/pie_series.rb
@@ -25,7 +25,7 @@ module Axlsx
# @option options [String] title
# @option options [Integer] explosion
# @param [Chart] chart
- def initialize(chart, options={})
+ def initialize(chart, options = {})
@explosion = nil
@colors = []
super(chart, options)
diff --git a/lib/axlsx/drawing/scaling.rb b/lib/axlsx/drawing/scaling.rb
index 82811c11..8d2d8ed7 100644
--- a/lib/axlsx/drawing/scaling.rb
+++ b/lib/axlsx/drawing/scaling.rb
@@ -8,7 +8,7 @@ module Axlsx
# @option options [Symbol] orientation
# @option options [Float] max
# @option options [Float] min
- def initialize(options={})
+ def initialize(options = {})
@orientation = :minMax
@logBase, @min, @max = nil, nil, nil
parse_options options
@@ -33,7 +33,7 @@ module Axlsx
attr_reader :min
# @see logBase
- def logBase=(v) DataTypeValidator.validate "Scaling.logBase", [Integer], v, lambda { |arg| arg >= 2 && arg <= 1000}; @logBase = v; end
+ def logBase=(v) DataTypeValidator.validate "Scaling.logBase", [Integer], v, lambda { |arg| arg >= 2 && arg <= 1000 }; @logBase = v; end
# @see orientation
def orientation=(v) RestrictionValidator.validate "Scaling.orientation", [:minMax, :maxMin], v; @orientation = v; end
# @see max
diff --git a/lib/axlsx/drawing/scatter_chart.rb b/lib/axlsx/drawing/scatter_chart.rb
index fd6fa3d7..e43647a0 100644
--- a/lib/axlsx/drawing/scatter_chart.rb
+++ b/lib/axlsx/drawing/scatter_chart.rb
@@ -27,7 +27,7 @@ module Axlsx
alias :yValAxis :y_val_axis
# Creates a new scatter chart
- def initialize(frame, options={})
+ def initialize(frame, options = {})
@vary_colors = 0
@scatter_style = :lineMarker
diff --git a/lib/axlsx/drawing/scatter_series.rb b/lib/axlsx/drawing/scatter_series.rb
index dba1fdf5..e4e1f27a 100644
--- a/lib/axlsx/drawing/scatter_series.rb
+++ b/lib/axlsx/drawing/scatter_series.rb
@@ -34,7 +34,7 @@ module Axlsx
attr_reader :marker_symbol
# Creates a new ScatterSeries
- def initialize(chart, options={})
+ def initialize(chart, options = {})
@xData, @yData = nil
if options[:smooth].nil?
# If caller hasn't specified smoothing or not, turn smoothing on or off based on scatter style
@@ -50,7 +50,7 @@ module Axlsx
super(chart, options)
@xData = AxDataSource.new(:tag_name => :xVal, :data => options[:xData]) unless options[:xData].nil?
- @yData = NumDataSource.new({:tag_name => :yVal, :data => options[:yData]}) unless options[:yData].nil?
+ @yData = NumDataSource.new({ :tag_name => :yVal, :data => options[:yData] }) unless options[:yData].nil?
end
# @see color
diff --git a/lib/axlsx/drawing/ser_axis.rb b/lib/axlsx/drawing/ser_axis.rb
index f1da6037..b5844454 100644
--- a/lib/axlsx/drawing/ser_axis.rb
+++ b/lib/axlsx/drawing/ser_axis.rb
@@ -14,7 +14,7 @@ module Axlsx
# Creates a new SerAxis object
# @option options [Integer] tick_lbl_skip
# @option options [Integer] tick_mark_skip
- def initialize(options={})
+ def initialize(options = {})
@tick_lbl_skip, @tick_mark_skip = 1, 1
super(options)
end
diff --git a/lib/axlsx/drawing/series.rb b/lib/axlsx/drawing/series.rb
index e2445bc9..e5c66b59 100644
--- a/lib/axlsx/drawing/series.rb
+++ b/lib/axlsx/drawing/series.rb
@@ -18,7 +18,7 @@ module Axlsx
# @param [Chart] chart
# @option options [Integer] order
# @option options [String] title
- def initialize(chart, options={})
+ def initialize(chart, options = {})
@order = nil
self.chart = chart
@chart.series << self
diff --git a/lib/axlsx/drawing/str_data.rb b/lib/axlsx/drawing/str_data.rb
index e4f94e89..843c90a7 100644
--- a/lib/axlsx/drawing/str_data.rb
+++ b/lib/axlsx/drawing/str_data.rb
@@ -7,7 +7,7 @@ module Axlsx
# creates a new StrVal object
# @option options [Array] :data
# @option options [String] :tag_name
- def initialize(options={})
+ def initialize(options = {})
@tag_prefix = :str
@type = StrVal
@pt = SimpleTypedList.new(@type)
@@ -16,7 +16,7 @@ module Axlsx
# Creates the val objects for this data set. I am not overly confident this is going to play nicely with time and data types.
# @param [Array] values An array of cells or values.
- def data=(values=[])
+ def data=(values = [])
@tag_name = values.first.is_a?(Cell) ? :strCache : :strLit
values.each do |value|
v = value.is_a?(Cell) ? value.value : value
diff --git a/lib/axlsx/drawing/str_val.rb b/lib/axlsx/drawing/str_val.rb
index 26f12e26..4a85d256 100644
--- a/lib/axlsx/drawing/str_val.rb
+++ b/lib/axlsx/drawing/str_val.rb
@@ -5,7 +5,7 @@ module Axlsx
# creates a new StrVal object
# @option options [String] v
- def initialize(options={})
+ def initialize(options = {})
@v = ""
@idx = 0
parse_options options
diff --git a/lib/axlsx/drawing/title.rb b/lib/axlsx/drawing/title.rb
index 0c613e13..1a43ba80 100644
--- a/lib/axlsx/drawing/title.rb
+++ b/lib/axlsx/drawing/title.rb
@@ -15,7 +15,7 @@ module Axlsx
# Creates a new Title object
# @param [String, Cell] title The cell or string to be used for the chart's title
- def initialize(title="", title_size="")
+ def initialize(title = "", title_size = "")
self.cell = title if title.is_a?(Cell)
self.text = title.to_s unless title.is_a?(Cell)
if title_size.to_s.empty?
diff --git a/lib/axlsx/drawing/two_cell_anchor.rb b/lib/axlsx/drawing/two_cell_anchor.rb
index aa38c3db..7b77de13 100644
--- a/lib/axlsx/drawing/two_cell_anchor.rb
+++ b/lib/axlsx/drawing/two_cell_anchor.rb
@@ -30,10 +30,10 @@ module Axlsx
# @param [Drawing] drawing
# @option options [Array] :start_at the col, row to start at THIS IS DOCUMENTED BUT NOT IMPLEMENTED HERE!
# @option options [Array] :end_at the col, row to end at
- def initialize(drawing, options={})
+ def initialize(drawing, options = {})
@drawing = drawing
drawing.anchors << self
- @from, @to = Marker.new, Marker.new(:col => 5, :row=>10)
+ @from, @to = Marker.new, Marker.new(:col => 5, :row => 10)
parse_options options
# bit of a hack to work around the fact that the coords for start at and end at
@@ -46,7 +46,7 @@ module Axlsx
# @note The recommended way to set the start position for graphical
# objects is directly thru the object.
# @see Chart#start_at
- def start_at(x, y=nil)
+ def start_at(x, y = nil)
from.coord x, y
end
@@ -54,7 +54,7 @@ module Axlsx
# @note the recommended way to set the to position for graphical
# objects is directly thru the object
# @see Char#end_at
- def end_at(x, y=nil)
+ def end_at(x, y = nil)
to.coord x, y
end
@@ -66,7 +66,7 @@ module Axlsx
end
# Creates an image associated with this anchor.
- def add_pic(options={})
+ def add_pic(options = {})
@object = Pic.new(self, options)
end
diff --git a/lib/axlsx/drawing/val_axis.rb b/lib/axlsx/drawing/val_axis.rb
index ead09ff8..8cd131cc 100644
--- a/lib/axlsx/drawing/val_axis.rb
+++ b/lib/axlsx/drawing/val_axis.rb
@@ -9,7 +9,7 @@ module Axlsx
# Creates a new ValAxis object
# @option options [Symbol] crosses_between
- def initialize(options={})
+ def initialize(options = {})
self.cross_between = :between
super(options)
end
diff --git a/lib/axlsx/drawing/view_3D.rb b/lib/axlsx/drawing/view_3D.rb
index 250f53f2..1adf9e28 100644
--- a/lib/axlsx/drawing/view_3D.rb
+++ b/lib/axlsx/drawing/view_3D.rb
@@ -10,7 +10,7 @@ module Axlsx
# @option options [String] depth_percent
# @option options [Boolean] r_ang_ax
# @option options [Integer] perspective
- def initialize(options={})
+ def initialize(options = {})
@rot_x, @h_percent, @rot_y, @depth_percent, @r_ang_ax, @perspective = nil, nil, nil, nil, nil, nil
parse_options options
end
@@ -105,7 +105,7 @@ module Axlsx
private
# Note: move this to Axlsx module if we find the smae pattern elsewhere.
- def element_for_attribute(name, namespace='')
+ def element_for_attribute(name, namespace = '')
val = Axlsx.instance_values_for(self)[name]
return "" if val == nil
"<%s:%s val='%s'/>" % [namespace, Axlsx::camel(name, false), val]
diff --git a/lib/axlsx/drawing/vml_drawing.rb b/lib/axlsx/drawing/vml_drawing.rb
index ccf3e421..e314b736 100644
--- a/lib/axlsx/drawing/vml_drawing.rb
+++ b/lib/axlsx/drawing/vml_drawing.rb
@@ -23,7 +23,7 @@ module Axlsx
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel">
<o:shapelayout v:ext="edit">
- <o:idmap v:ext="edit" data="#{@comments.worksheet.index+1}"/>
+ <o:idmap v:ext="edit" data="#{@comments.worksheet.index + 1}"/>
</o:shapelayout>
<v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202"
path="m0,0l0,21600,21600,21600,21600,0xe">
diff --git a/lib/axlsx/drawing/vml_shape.rb b/lib/axlsx/drawing/vml_shape.rb
index 951cd58d..2ba388b3 100644
--- a/lib/axlsx/drawing/vml_shape.rb
+++ b/lib/axlsx/drawing/vml_shape.rb
@@ -15,14 +15,14 @@ module Axlsx
# @option options [Integer] right_offset
# @option options [Integer] bottom_row
# @option options [Integer] bottom_offset
- def initialize(options={})
+ def initialize(options = {})
@row = @column = @left_column = @top_row = @right_column = @bottom_row = 0
@left_offset = 15
@top_offset = 2
@right_offset = 50
@bottom_offset = 5
@visible = true
- @id = (0...8).map{65.+(rand(25)).chr}.join
+ @id = (0...8).map { 65.+(rand(25)).chr }.join
parse_options options
yield self if block_given?
end
@@ -35,7 +35,7 @@ module Axlsx
# serialize the shape to a string
# @param [String] str
# @return [String]
- def to_xml_string(str ='')
+ def to_xml_string(str = '')
str << <<SHAME_ON_YOU
<v:shape id="#{@id}" type="#_x0000_t202" fillcolor="#ffffa1 [80]" o:insetmode="auto"
diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb
index 0c03b1a2..f249073c 100644
--- a/lib/axlsx/package.rb
+++ b/lib/axlsx/package.rb
@@ -19,7 +19,7 @@ module Axlsx
# @option options [Time] :created_at Timestamp in the document properties (defaults to current time).
# @option options [Boolean] :use_shared_strings This is passed to the workbook to specify that shared strings should be used when serializing the package.
# @example Package.new :author => 'you!', :workbook => Workbook.new
- def initialize(options={})
+ def initialize(options = {})
@workbook = nil
@core, @app = Core.new, App.new
@core.creator = options[:author] || @core.creator
@@ -122,7 +122,7 @@ module Axlsx
# Serialize your workbook to a StringIO instance
# @param [Boolean] confirm_valid Validate the package prior to serialization.
# @return [StringIO|Boolean] False if confirm_valid and validation errors exist. rewound string IO if not.
- def to_stream(confirm_valid=false)
+ def to_stream(confirm_valid = false)
if !workbook.styles_applied
workbook.apply_styles
end
@@ -211,26 +211,26 @@ 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|
@@ -241,26 +241,26 @@ module Axlsx
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}
+ parts << { :entry => "xl/#{image.pn}", :path => image.image_src }
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
@@ -332,7 +332,7 @@ module Axlsx
elsif ext == 'png'
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}",
diff --git a/lib/axlsx/rels/relationship.rb b/lib/axlsx/rels/relationship.rb
index f1759649..aff9fa55 100644
--- a/lib/axlsx/rels/relationship.rb
+++ b/lib/axlsx/rels/relationship.rb
@@ -81,10 +81,10 @@ module Axlsx
# @param [String] type The type of the relationship
# @param [String] target The target for the relationship
# @option [Symbol] :target_mode only accepts :external.
- def initialize(source_obj, type, target, options={})
+ def initialize(source_obj, type, target, options = {})
@source_obj = source_obj
- self.Target=target
- self.Type=type
+ self.Target = target
+ self.Type = type
self.TargetMode = options[:target_mode] if options[:target_mode]
@Id = (self.class.ids_cache[ids_cache_key] ||= self.class.next_free_id)
end
@@ -101,9 +101,9 @@ module Axlsx
# @param [String] str
# @return [String]
def to_xml_string(str = '')
- h = Axlsx.instance_values_for(self).reject{|k, _| k == "source_obj"}
+ h = Axlsx.instance_values_for(self).reject { |k, _| k == "source_obj" }
str << '<Relationship '
- str << (h.map { |key, value| '' << key.to_s << '="' << Axlsx::coder.encode(value.to_s) << '"'}.join(' '))
+ str << (h.map { |key, value| '' << key.to_s << '="' << Axlsx::coder.encode(value.to_s) << '"' }.join(' '))
str << '/>'
end
diff --git a/lib/axlsx/rels/relationships.rb b/lib/axlsx/rels/relationships.rb
index 8f3b62cc..686059fb 100644
--- a/lib/axlsx/rels/relationships.rb
+++ b/lib/axlsx/rels/relationships.rb
@@ -13,7 +13,7 @@ require 'axlsx/rels/relationship.rb'
# @see Relationship#source_obj
# @return [Relationship]
def for(source_obj)
- find{ |rel| rel.source_obj == source_obj }
+ find { |rel| rel.source_obj == source_obj }
end
# serialize relationships
@@ -22,7 +22,7 @@ require 'axlsx/rels/relationship.rb'
def to_xml_string(str = '')
str << '<?xml version="1.0" encoding="UTF-8"?>'
str << ('<Relationships xmlns="' << RELS_R << '">')
- each{ |rel| rel.to_xml_string(str) }
+ each { |rel| rel.to_xml_string(str) }
str << '</Relationships>'
end
end
diff --git a/lib/axlsx/stylesheet/border.rb b/lib/axlsx/stylesheet/border.rb
index b9ff785b..af564b22 100644
--- a/lib/axlsx/stylesheet/border.rb
+++ b/lib/axlsx/stylesheet/border.rb
@@ -19,7 +19,7 @@ module Axlsx
#
# @note The recommended way to manage borders is with Style#add_style
# @see Style#add_style
- def initialize(options={})
+ def initialize(options = {})
@prs = SimpleTypedList.new BorderPr
parse_options options
end
diff --git a/lib/axlsx/stylesheet/border_pr.rb b/lib/axlsx/stylesheet/border_pr.rb
index 630cf42e..8300f4bc 100644
--- a/lib/axlsx/stylesheet/border_pr.rb
+++ b/lib/axlsx/stylesheet/border_pr.rb
@@ -43,7 +43,7 @@ module Axlsx
# @option options [Symbol] name
# @option options [Symbol] style
# @see Axlsx::Border
- def initialize(options={})
+ def initialize(options = {})
parse_options(options)
#options.each do |o|
# self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
diff --git a/lib/axlsx/stylesheet/cell_alignment.rb b/lib/axlsx/stylesheet/cell_alignment.rb
index cf03c171..906c7870 100644
--- a/lib/axlsx/stylesheet/cell_alignment.rb
+++ b/lib/axlsx/stylesheet/cell_alignment.rb
@@ -17,7 +17,7 @@ module Axlsx
# @option options [Boolean] justify_last_line
# @option options [Boolean] shrink_to_fit
# @option options [Integer] reading_order
- def initialize(options={})
+ def initialize(options = {})
parse_options options
end
diff --git a/lib/axlsx/stylesheet/cell_protection.rb b/lib/axlsx/stylesheet/cell_protection.rb
index 6d98ff19..f040f207 100644
--- a/lib/axlsx/stylesheet/cell_protection.rb
+++ b/lib/axlsx/stylesheet/cell_protection.rb
@@ -19,7 +19,7 @@ module Axlsx
# Creates a new CellProtection
# @option options [Boolean] hidden value for hidden protection
# @option options [Boolean] locked value for locked protection
- def initialize(options={})
+ def initialize(options = {})
parse_options options
end
diff --git a/lib/axlsx/stylesheet/cell_style.rb b/lib/axlsx/stylesheet/cell_style.rb
index e2c3a09e..1e35a1a4 100644
--- a/lib/axlsx/stylesheet/cell_style.rb
+++ b/lib/axlsx/stylesheet/cell_style.rb
@@ -13,7 +13,7 @@ module Axlsx
# @option options [Integer] iLevel
# @option options [Boolean] hidden
# @option options [Boolean] customBuiltIn
- def initialize(options={})
+ def initialize(options = {})
parse_options options
end
diff --git a/lib/axlsx/stylesheet/color.rb b/lib/axlsx/stylesheet/color.rb
index 709d22c3..28afaf11 100644
--- a/lib/axlsx/stylesheet/color.rb
+++ b/lib/axlsx/stylesheet/color.rb
@@ -8,7 +8,7 @@ module Axlsx
# @option options [Boolean] auto
# @option options [String] rgb
# @option options [Float] tint
- def initialize(options={})
+ def initialize(options = {})
@rgb = "FF000000"
parse_options options
end
diff --git a/lib/axlsx/stylesheet/dxf.rb b/lib/axlsx/stylesheet/dxf.rb
index 637e3d54..a3f15581 100644
--- a/lib/axlsx/stylesheet/dxf.rb
+++ b/lib/axlsx/stylesheet/dxf.rb
@@ -42,7 +42,7 @@ module Axlsx
# @option options [Font] font
# @option options [CellAlignment] alignment
# @option options [CellProtection] protection
- def initialize(options={})
+ def initialize(options = {})
parse_options options
end
diff --git a/lib/axlsx/stylesheet/font.rb b/lib/axlsx/stylesheet/font.rb
index 9ce5ae4a..0f432d58 100644
--- a/lib/axlsx/stylesheet/font.rb
+++ b/lib/axlsx/stylesheet/font.rb
@@ -20,7 +20,7 @@ module Axlsx
# @option options [Boolean] extend
# @option options [Color] color
# @option options [Integer] sz
- def initialize(options={})
+ def initialize(options = {})
parse_options options
end
@@ -139,9 +139,9 @@ module Axlsx
# @see extend
def extend=(v) Axlsx::validate_boolean v; @extend = v end
# @see color
- def color=(v) DataTypeValidator.validate "Font.color", Color, v; @color=v end
+ def color=(v) DataTypeValidator.validate "Font.color", Color, v; @color = v end
# @see sz
- def sz=(v) Axlsx::validate_unsigned_int v; @sz=v end
+ def sz=(v) Axlsx::validate_unsigned_int v; @sz = v end
# Serializes the object
# @param [String] str
diff --git a/lib/axlsx/stylesheet/gradient_fill.rb b/lib/axlsx/stylesheet/gradient_fill.rb
index 8d88f373..dc4e562b 100644
--- a/lib/axlsx/stylesheet/gradient_fill.rb
+++ b/lib/axlsx/stylesheet/gradient_fill.rb
@@ -12,7 +12,7 @@ module Axlsx
# @option options [Float] right
# @option options [Float] top
# @option options [Float] bottom
- def initialize(options={})
+ def initialize(options = {})
options[:type] ||= :linear
parse_options options
@stop = SimpleTypedList.new GradientStop
@@ -84,7 +84,7 @@ module Axlsx
# validates that the value provided is between 0.0 and 1.0
def validate_format_percentage(name, value)
- DataTypeValidator.validate name, Float, value, lambda { |arg| arg >= 0.0 && arg <= 1.0}
+ DataTypeValidator.validate name, Float, value, lambda { |arg| arg >= 0.0 && arg <= 1.0 }
end
# Serializes the object
diff --git a/lib/axlsx/stylesheet/gradient_stop.rb b/lib/axlsx/stylesheet/gradient_stop.rb
index 63778b58..2325ee66 100644
--- a/lib/axlsx/stylesheet/gradient_stop.rb
+++ b/lib/axlsx/stylesheet/gradient_stop.rb
@@ -20,9 +20,9 @@ module Axlsx
end
# @see color
- def color=(v) DataTypeValidator.validate "GradientStop.color", Color, v; @color=v end
+ def color=(v) DataTypeValidator.validate "GradientStop.color", Color, v; @color = v end
# @see position
- def position=(v) DataTypeValidator.validate "GradientStop.position", Float, v, lambda { |arg| arg >= 0 && arg <= 1}; @position = v end
+ def position=(v) DataTypeValidator.validate "GradientStop.position", Float, v, lambda { |arg| arg >= 0 && arg <= 1 }; @position = v end
# Serializes the object
# @param [String] str
diff --git a/lib/axlsx/stylesheet/num_fmt.rb b/lib/axlsx/stylesheet/num_fmt.rb
index ed239dfc..388f0d59 100644
--- a/lib/axlsx/stylesheet/num_fmt.rb
+++ b/lib/axlsx/stylesheet/num_fmt.rb
@@ -9,7 +9,7 @@ module Axlsx
# @param [Hash] options Options for the number format object
# @option [Integer] numFmtId The predefined format id or new format id for this format
# @option [String] formatCode The format code for this number format
- def initialize(options={})
+ def initialize(options = {})
@numFmtId = 0
@formatCode = ""
parse_options options
diff --git a/lib/axlsx/stylesheet/pattern_fill.rb b/lib/axlsx/stylesheet/pattern_fill.rb
index 0bcef74b..3ebd4ff6 100644
--- a/lib/axlsx/stylesheet/pattern_fill.rb
+++ b/lib/axlsx/stylesheet/pattern_fill.rb
@@ -8,7 +8,7 @@ module Axlsx
# @option options [Symbol] patternType
# @option options [Color] fgColor
# @option options [Color] bgColor
- def initialize(options={})
+ def initialize(options = {})
@patternType = :none
parse_options options
end
@@ -47,9 +47,9 @@ module Axlsx
attr_reader :patternType
# @see fgColor
- def fgColor=(v) DataTypeValidator.validate "PatternFill.fgColor", Color, v; @fgColor=v end
+ def fgColor=(v) DataTypeValidator.validate "PatternFill.fgColor", Color, v; @fgColor = v end
# @see bgColor
- def bgColor=(v) DataTypeValidator.validate "PatternFill.bgColor", Color, v; @bgColor=v end
+ def bgColor=(v) DataTypeValidator.validate "PatternFill.bgColor", Color, v; @bgColor = v end
# @see patternType
def patternType=(v) Axlsx::validate_pattern_type v; @patternType = v end
diff --git a/lib/axlsx/stylesheet/styles.rb b/lib/axlsx/stylesheet/styles.rb
index a1f541c9..e55e2c95 100644
--- a/lib/axlsx/stylesheet/styles.rb
+++ b/lib/axlsx/stylesheet/styles.rb
@@ -224,11 +224,11 @@ module Axlsx
#
# An index for cell styles where keys are styles codes as per Axlsx::Style and values are Cell#raw_style
# The reason for the backward key/value ordering is that style lookup must be most efficient, while `add_style` can be less efficient
- def add_style(options={})
+ def add_style(options = {})
# Default to :xf
options[:type] ||= :xf
- raise ArgumentError, "Type must be one of [:xf, :dxf]" unless [:xf, :dxf].include?(options[:type] )
+ raise ArgumentError, "Type must be one of [:xf, :dxf]" unless [:xf, :dxf].include?(options[:type])
if options[:border].is_a?(Hash)
if options[:border][:edges] == :all
@@ -241,9 +241,9 @@ module Axlsx
if options[:type] == :xf
# Check to see if style in cache already
- font_defaults = {name: @fonts.first.name, sz: @fonts.first.sz, family: @fonts.first.family}
+ font_defaults = { name: @fonts.first.name, sz: @fonts.first.sz, family: @fonts.first.family }
- raw_style = {type: :xf}.merge(font_defaults).merge(options)
+ raw_style = { type: :xf }.merge(font_defaults).merge(options)
if raw_style[:format_code]
raw_style.delete(:num_fmt)
@@ -267,7 +267,7 @@ module Axlsx
when :dxf
style = Dxf.new :fill => fill, :font => font, :numFmt => numFmt, :border => border, :alignment => alignment, :protection => protection
else
- style = Xf.new :fillId=>fill || 0, :fontId=>font || 0, :numFmtId=>numFmt || 0, :borderId=>border || 0, :alignment => alignment, :protection => protection, :applyFill=>!fill.nil?, :applyFont=>!font.nil?, :applyNumberFormat =>!numFmt.nil?, :applyBorder=>!border.nil?, :applyAlignment => !alignment.nil?, :applyProtection => !protection.nil?
+ style = Xf.new :fillId => fill || 0, :fontId => font || 0, :numFmtId => numFmt || 0, :borderId => border || 0, :alignment => alignment, :protection => protection, :applyFill => !fill.nil?, :applyFont => !font.nil?, :applyNumberFormat => !numFmt.nil?, :applyBorder => !border.nil?, :applyAlignment => !alignment.nil?, :applyProtection => !protection.nil?
end
if options[:type] == :xf
@@ -290,7 +290,7 @@ module Axlsx
# @option options [Boolean] hide boolean value defining cell protection attribute for hiding.
# @option options [Boolean] locked boolean value defining cell protection attribute for locking.
# @return [CellProtection]
- def parse_protection_options(options={})
+ def parse_protection_options(options = {})
return if (options.keys & [:hidden, :locked]).empty?
CellProtection.new(options)
end
@@ -300,7 +300,7 @@ module Axlsx
# @option options [Hash] alignment A hash of options to prive the CellAlignment intializer
# @return [CellAlignment]
# @see CellAlignment
- def parse_alignment_options(options={})
+ def parse_alignment_options(options = {})
return unless options[:alignment]
CellAlignment.new options[:alignment]
end
@@ -320,7 +320,7 @@ module Axlsx
# @option options [Integer] family The font family to use.
# @option options [String] font_name The name of the font to use
# @return [Font|Integer]
- def parse_font_options(options={})
+ def parse_font_options(options = {})
return if (options.keys & [:fg_color, :sz, :b, :i, :u, :strike, :outline, :shadow, :charset, :family, :font_name]).empty?
Axlsx.instance_values_for(fonts.first).each do |key, value|
# Thanks for that 1.8.7 - cant do a simple merge...
@@ -336,12 +336,12 @@ module Axlsx
# @note noop if :bg_color is not specified in options
# @option options [String] bg_color The rgb color to apply to the fill
# @return [Fill|Integer]
- def parse_fill_options(options={})
+ def parse_fill_options(options = {})
return unless options[:bg_color]
- color = Color.new(:rgb=>options[:bg_color])
+ color = Color.new(:rgb => options[:bg_color])
dxf = options[:type] == :dxf
color_key = dxf ? :bgColor : :fgColor
- pattern = PatternFill.new(:patternType =>:solid, color_key=>color)
+ pattern = PatternFill.new(:patternType => :solid, color_key => color)
fill = Fill.new(pattern)
dxf ? fill : fills << fill
end
@@ -359,8 +359,8 @@ module Axlsx
# #apply a thick red border to the top and bottom
# { :border => { :style => :thick, :color => "FFFF0000", :edges => [:top, :bottom] }
# @return [Border|Integer]
- def parse_border_options(options={})
- if options[:border].nil? && Border::EDGES.all?{|x| options["border_#{x}".to_sym].nil? }
+ def parse_border_options(options = {})
+ if options[:border].nil? && Border::EDGES.all? { |x| options["border_#{x}".to_sym].nil? }
return nil
end
@@ -376,7 +376,7 @@ module Axlsx
end
end
- validate_border_hash = ->(val){
+ validate_border_hash = ->(val) {
if !(val.keys.include?(:style) && val.keys.include?(:color))
raise ArgumentError, (ERR_INVALID_BORDER_OPTIONS % options[:border])
end
@@ -461,15 +461,15 @@ module Axlsx
# noop if neither :format_code or :num_format options are set.
# @option options [Hash] A hash describing the :format_code and/or :num_fmt integer for the style.
# @return [NumFmt|Integer]
- def parse_num_fmt_options(options={})
+ def parse_num_fmt_options(options = {})
return if (options.keys & [:format_code, :num_fmt]).empty?
#When the user provides format_code - we always need to create a new numFmt object
#When the type is :dxf we always need to create a new numFmt object
if options[:format_code] || options[:type] == :dxf
#If this is a standard xf we pull from numFmts the highest current and increment for num_fmt
- options[:num_fmt] ||= (@numFmts.map{ |num_fmt| num_fmt.numFmtId }.max + 1) if options[:type] != :dxf
- numFmt = NumFmt.new(:numFmtId => options[:num_fmt] || 0, :formatCode=> options[:format_code].to_s)
+ options[:num_fmt] ||= (@numFmts.map { |num_fmt| num_fmt.numFmtId }.max + 1) if options[:type] != :dxf
+ numFmt = NumFmt.new(:numFmtId => options[:num_fmt] || 0, :formatCode => options[:format_code].to_s)
options[:type] == :dxf ? numFmt : (numFmts << numFmt; numFmt.numFmtId)
else
options[:num_fmt]
@@ -494,42 +494,42 @@ module Axlsx
# Axlsx::STYLE_THIN_BORDER
def load_default_styles
@numFmts = SimpleTypedList.new NumFmt, 'numFmts'
- @numFmts << NumFmt.new(:numFmtId => NUM_FMT_YYYYMMDD, :formatCode=> "yyyy/mm/dd")
- @numFmts << NumFmt.new(:numFmtId => NUM_FMT_YYYYMMDDHHMMSS, :formatCode=> "yyyy/mm/dd hh:mm:ss")
+ @numFmts << NumFmt.new(:numFmtId => NUM_FMT_YYYYMMDD, :formatCode => "yyyy/mm/dd")
+ @numFmts << NumFmt.new(:numFmtId => NUM_FMT_YYYYMMDDHHMMSS, :formatCode => "yyyy/mm/dd hh:mm:ss")
@numFmts.lock
@fonts = SimpleTypedList.new Font, 'fonts'
- @fonts << Font.new(:name => "Arial", :sz => 11, :family=>1)
+ @fonts << Font.new(:name => "Arial", :sz => 11, :family => 1)
@fonts.lock
@fills = SimpleTypedList.new Fill, 'fills'
- @fills << Fill.new(Axlsx::PatternFill.new(:patternType=>:none))
- @fills << Fill.new(Axlsx::PatternFill.new(:patternType=>:gray125))
+ @fills << Fill.new(Axlsx::PatternFill.new(:patternType => :none))
+ @fills << Fill.new(Axlsx::PatternFill.new(:patternType => :gray125))
@fills.lock
@borders = SimpleTypedList.new Border, 'borders'
@borders << Border.new
black_border = Border.new
[:left, :right, :top, :bottom].each do |item|
- black_border.prs << BorderPr.new(:name=>item, :style=>:thin, :color=>Color.new(:rgb=>"FF000000"))
+ black_border.prs << BorderPr.new(:name => item, :style => :thin, :color => Color.new(:rgb => "FF000000"))
end
@borders << black_border
@borders.lock
@cellStyleXfs = SimpleTypedList.new Xf, "cellStyleXfs"
- @cellStyleXfs << Xf.new(:borderId=>0, :numFmtId=>0, :fontId=>0, :fillId=>0)
+ @cellStyleXfs << Xf.new(:borderId => 0, :numFmtId => 0, :fontId => 0, :fillId => 0)
@cellStyleXfs.lock
@cellStyles = SimpleTypedList.new CellStyle, 'cellStyles'
- @cellStyles << CellStyle.new(:name =>"Normal", :builtinId =>0, :xfId=>0)
+ @cellStyles << CellStyle.new(:name => "Normal", :builtinId => 0, :xfId => 0)
@cellStyles.lock
@cellXfs = SimpleTypedList.new Xf, "cellXfs"
- @cellXfs << Xf.new(:borderId=>0, :xfId=>0, :numFmtId=>0, :fontId=>0, :fillId=>0)
- @cellXfs << Xf.new(:borderId=>1, :xfId=>0, :numFmtId=>0, :fontId=>0, :fillId=>0)
+ @cellXfs << Xf.new(:borderId => 0, :xfId => 0, :numFmtId => 0, :fontId => 0, :fillId => 0)
+ @cellXfs << Xf.new(:borderId => 1, :xfId => 0, :numFmtId => 0, :fontId => 0, :fillId => 0)
# default date formatting
- @cellXfs << Xf.new(:borderId=>0, :xfId=>0, :numFmtId=>14, :fontId=>0, :fillId=>0, :applyNumberFormat=>1)
+ @cellXfs << Xf.new(:borderId => 0, :xfId => 0, :numFmtId => 14, :fontId => 0, :fillId => 0, :applyNumberFormat => 1)
@cellXfs.lock
@dxfs = SimpleTypedList.new(Dxf, "dxfs"); @dxfs.lock
diff --git a/lib/axlsx/stylesheet/table_style.rb b/lib/axlsx/stylesheet/table_style.rb
index edef6216..f656ce3d 100644
--- a/lib/axlsx/stylesheet/table_style.rb
+++ b/lib/axlsx/stylesheet/table_style.rb
@@ -10,7 +10,7 @@ module Axlsx
# @param [String] name
# @option options [Boolean] pivot
# @option options [Boolean] table
- def initialize(name, options={})
+ def initialize(name, options = {})
self.name = name
parse_options options
super TableStyleElement
@@ -31,18 +31,18 @@ module Axlsx
attr_reader :table
# @see name
- def name=(v) Axlsx::validate_string v; @name=v end
+ def name=(v) Axlsx::validate_string v; @name = v end
# @see pivot
- def pivot=(v) Axlsx::validate_boolean v; @pivot=v end
+ def pivot=(v) Axlsx::validate_boolean v; @pivot = v end
# @see table
- def table=(v) Axlsx::validate_boolean v; @table=v end
+ def table=(v) Axlsx::validate_boolean v; @table = v end
# Serializes the object
# @param [String] str
# @return [String]
def to_xml_string(str = '')
str << '<tableStyle '
- serialized_attributes str, {:count => self.size}
+ serialized_attributes str, { :count => self.size }
str << '>'
each { |table_style_el| table_style_el.to_xml_string(str) }
str << '</tableStyle>'
diff --git a/lib/axlsx/stylesheet/table_style_element.rb b/lib/axlsx/stylesheet/table_style_element.rb
index 4bc2a787..845d6bac 100644
--- a/lib/axlsx/stylesheet/table_style_element.rb
+++ b/lib/axlsx/stylesheet/table_style_element.rb
@@ -9,7 +9,7 @@ module Axlsx
# @option options [Symbol] type
# @option options [Integer] size
# @option options [Integer] dxfId
- def initialize(options={})
+ def initialize(options = {})
parse_options options
end
diff --git a/lib/axlsx/stylesheet/table_styles.rb b/lib/axlsx/stylesheet/table_styles.rb
index 27c75609..a55180a5 100644
--- a/lib/axlsx/stylesheet/table_styles.rb
+++ b/lib/axlsx/stylesheet/table_styles.rb
@@ -7,7 +7,7 @@ module Axlsx
# Creates a new TableStyles object that is a container for TableStyle objects
# @option options [String] defaultTableStyle
# @option options [String] defaultPivotStyle
- def initialize(options={})
+ def initialize(options = {})
@defaultTableStyle = options[:defaultTableStyle] || "TableStyleMedium9"
@defaultPivotStyle = options[:defaultPivotStyle] || "PivotStyleLight16"
super TableStyle
@@ -33,7 +33,7 @@ module Axlsx
# @return [String]
def to_xml_string(str = '')
str << '<tableStyles '
- serialized_attributes str, {:count => self.size }
+ serialized_attributes str, { :count => self.size }
str << '>'
each { |table_style| table_style.to_xml_string(str) }
str << '</tableStyles>'
diff --git a/lib/axlsx/stylesheet/xf.rb b/lib/axlsx/stylesheet/xf.rb
index 8b3b11b6..e7a84a46 100644
--- a/lib/axlsx/stylesheet/xf.rb
+++ b/lib/axlsx/stylesheet/xf.rb
@@ -22,7 +22,7 @@ module Axlsx
# @option options [Boolean] applyProtection
# @option options [CellAlignment] alignment
# @option options [CellProtection] protection
- def initialize(options={})
+ def initialize(options = {})
parse_options options
end
diff --git a/lib/axlsx/util/constants.rb b/lib/axlsx/util/constants.rb
index 401db1b8..7a49a0eb 100644
--- a/lib/axlsx/util/constants.rb
+++ b/lib/axlsx/util/constants.rb
@@ -237,7 +237,7 @@ module Axlsx
COMMENT_PN = "comments%d.xml".freeze
# location of schema files for validation
- SCHEMA_BASE = (File.dirname(__FILE__)+'/../../schema/').freeze
+ SCHEMA_BASE = (File.dirname(__FILE__) + '/../../schema/').freeze
# App validation schema
APP_XSD = (SCHEMA_BASE + "shared-documentPropertiesExtended.xsd").freeze
diff --git a/lib/axlsx/util/options_parser.rb b/lib/axlsx/util/options_parser.rb
index 01a1b29b..3f2c1937 100644
--- a/lib/axlsx/util/options_parser.rb
+++ b/lib/axlsx/util/options_parser.rb
@@ -5,7 +5,7 @@ module Axlsx
# Parses an options hash by calling any defined method by the same
# name of the key postfixed with an '='
# @param [Hash] options Options to parse.
- def parse_options(options={})
+ def parse_options(options = {})
options.each do |key, value|
key = :"#{key}="
self.send(key, value) if !value.nil? && self.respond_to?(key)
diff --git a/lib/axlsx/util/serialized_attributes.rb b/lib/axlsx/util/serialized_attributes.rb
index 2ac5c05f..9d46de75 100644
--- a/lib/axlsx/util/serialized_attributes.rb
+++ b/lib/axlsx/util/serialized_attributes.rb
@@ -71,7 +71,7 @@ module Axlsx
# @param [String] str The string instance to which serialized data is appended
# @param [Array] additional_attributes An array of additional attribute names.
# @return [String] The serialized output.
- def serialized_element_attributes(str='', additional_attributes=[], &block)
+ def serialized_element_attributes(str = '', additional_attributes = [], &block)
attrs = self.class.xml_element_attributes + additional_attributes
values = Axlsx.instance_values_for(self)
attrs.each do |attribute_name|
diff --git a/lib/axlsx/util/simple_typed_list.rb b/lib/axlsx/util/simple_typed_list.rb
index ddab916e..36651f1f 100644
--- a/lib/axlsx/util/simple_typed_list.rb
+++ b/lib/axlsx/util/simple_typed_list.rb
@@ -6,7 +6,7 @@ module Axlsx
# @param [Array, Class] type An array of Class objects or a single Class object
# @param [String] serialize_as The tag name to use in serialization
# @raise [ArgumentError] if all members of type are not Class objects
- def initialize type, serialize_as=nil, start_size = 0
+ def initialize type, serialize_as = nil, start_size = 0
if type.is_a? Array
type.each { |item| raise ArgumentError, "All members of type must be Class objects" unless item.is_a? Class }
@allowed_types = type
@@ -38,7 +38,7 @@ module Axlsx
def transpose
return @list.clone if @list.size == 0
row_count = @list.size
- max_column_count = @list.map{|row| row.cells.size}.max
+ max_column_count = @list.map { |row| row.cells.size }.max
result = Array.new(max_column_count) { Array.new(row_count) }
# yes, I know it is silly, but that warning is really annoying
row_count.times do |row_index|
@@ -164,7 +164,7 @@ module Axlsx
def to_xml_string(str = '')
classname = @allowed_types[0].name.split('::').last
- el_name = serialize_as.to_s || (classname[0,1].downcase + classname[1..-1])
+ el_name = serialize_as.to_s || (classname[0, 1].downcase + classname[1..-1])
str << ('<' << el_name << ' count="' << size.to_s << '">')
each { |item| item.to_xml_string(str) }
str << ('</' << el_name << '>')
diff --git a/lib/axlsx/util/storage.rb b/lib/axlsx/util/storage.rb
index 9712c563..c2f0739c 100644
--- a/lib/axlsx/util/storage.rb
+++ b/lib/axlsx/util/storage.rb
@@ -7,15 +7,15 @@ module Axlsx
# storage types
TYPES = {
- :root=>5,
- :stream=>2,
- :storage=>1
+ :root => 5,
+ :stream => 2,
+ :storage => 1
}.freeze
# Creates a byte string for this storage
# @return [String]
def to_s
- data = [@name.concat(Array.new([email protected], 0)),
+ data = [@name.concat(Array.new(32 - @name.size, 0)),
@name_size,
@type,
@color,
@@ -31,8 +31,8 @@ module Axlsx
# storage colors
COLORS = {
- :red=>0,
- :black=>1
+ :red => 0,
+ :black => 1
}
# The color of this node in the directory tree. Defaults to black if not specified
@@ -128,7 +128,7 @@ module Axlsx
# @option options [Integer] created (0)
# @option options [Integer] modified (0)
# @option options [Integer] sector (0)
- def initialize(name, options= {})
+ def initialize(name, options = {})
@left = @right = @child = -1
@sector = @size = @created = @modified = 0
options.each do |o|
diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb
index ebf8a280..266709b0 100644
--- a/lib/axlsx/util/validators.rb
+++ b/lib/axlsx/util/validators.rb
@@ -51,7 +51,7 @@ module Axlsx
# @raise [ArugumentError] Raised if the class of the value provided is not in the specified array of types or the block passed returns false
# @return [Boolean] true if validation succeeds.
# @see validate_boolean
- def self.validate(name, types, v, other=false)
+ def self.validate(name, types, v, other = false)
if other.is_a?(Proc)
raise ArgumentError, (ERR_TYPE % [v.inspect, name, types.inspect]) unless other.call(v)
end
diff --git a/lib/axlsx/workbook/defined_name.rb b/lib/axlsx/workbook/defined_name.rb
index 283a8e9d..4b819d4c 100644
--- a/lib/axlsx/workbook/defined_name.rb
+++ b/lib/axlsx/workbook/defined_name.rb
@@ -97,7 +97,7 @@ module Axlsx
# version of the workbook that is published to or rendered on a Web or application server.
# @option [Boolean] workbook_parameter - Specifies a boolean value that indicates that the name is used as a workbook parameter on a
# version of the workbook that is published to or rendered on a Web or application server.
- def initialize(formula, options={})
+ def initialize(formula, options = {})
@formula = formula
parse_options options
end
@@ -118,7 +118,7 @@ module Axlsx
serializable_attributes :short_cut_key, :status_bar, :help, :description, :custom_menu, :comment,
:workbook_parameter, :publish_to_server, :xlm, :vb_proceedure, :function, :hidden, :local_sheet_id
- def to_xml_string(str='')
+ def to_xml_string(str = '')
raise ArgumentError, 'you must specify the name for this defined name. Please read the documentation for Axlsx::DefinedName for more details' unless name
str << ('<definedName ' << 'name="' << name << '" ')
serialized_attributes str
diff --git a/lib/axlsx/workbook/shared_strings_table.rb b/lib/axlsx/workbook/shared_strings_table.rb
index 55040bc5..b8502206 100644
--- a/lib/axlsx/workbook/shared_strings_table.rb
+++ b/lib/axlsx/workbook/shared_strings_table.rb
@@ -30,12 +30,12 @@ module Axlsx
# Creates a new Shared Strings Table agains an array of cells
# @param [Array] cells This is an array of all of the cells in the workbook
# @param [Symbol] xml_space The xml:space behavior for the shared string table.
- def initialize(cells, xml_space=:preserve)
+ def initialize(cells, xml_space = :preserve)
@index = 0
@xml_space = xml_space
@unique_cells = {}
@shared_xml_string = ""
- shareable_cells = cells.flatten.select{ |cell| cell.plain_string? || cell.contains_rich_text? }
+ shareable_cells = cells.flatten.select { |cell| cell.plain_string? || cell.contains_rich_text? }
@count = shareable_cells.size
resolve(shareable_cells)
end
@@ -43,7 +43,7 @@ module Axlsx
# Serializes the object
# @param [String] str
# @return [String]
- def to_xml_string(str='')
+ def to_xml_string(str = '')
Axlsx::sanitize(@shared_xml_string)
str << ('<?xml version="1.0" encoding="UTF-8"?><sst xmlns="' << XML_NS << '"')
str << (' count="' << @count.to_s << '" uniqueCount="' << unique_count.to_s << '"')
diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb
index f2d9eab5..fde5d259 100644
--- a/lib/axlsx/workbook/workbook.rb
+++ b/lib/axlsx/workbook/workbook.rb
@@ -226,7 +226,7 @@ require 'axlsx/workbook/worksheet/selection.rb'
# Creates a new Workbook
# The recomended way to work with workbooks is via Package#workbook
# @option options [Boolean] date1904. If this is not specified, date1904 is set to false. Office 2011 for Mac defaults to false.
- def initialize(options={})
+ def initialize(options = {})
@styles = Styles.new
@worksheets = SimpleTypedList.new Worksheet
@drawings = SimpleTypedList.new Drawing
@@ -241,7 +241,7 @@ require 'axlsx/workbook/worksheet/selection.rb'
@bold_font_multiplier = BOLD_FONT_MULTIPLIER
@font_scale_divisor = FONT_SCALE_DIVISOR
- self.date1904= !options[:date1904].nil? && options[:date1904]
+ self.date1904 = !options[:date1904].nil? && options[:date1904]
yield self if block_given?
end
@@ -268,7 +268,7 @@ require 'axlsx/workbook/worksheet/selection.rb'
def use_autowidth() @use_autowidth; end
# see @use_autowidth
- def use_autowidth=(v=true) Axlsx::validate_boolean v; @use_autowidth = v; end
+ def use_autowidth=(v = true) Axlsx::validate_boolean v; @use_autowidth = v; end
# Font size of bold fonts is multiplied with this
# Used for automatic calculation of cell widths with bold text
@@ -298,7 +298,7 @@ require 'axlsx/workbook/worksheet/selection.rb'
# @param [Hash] options Options to pass into the worksheed during initialization.
# @option options [String] name The name of the worksheet
# @option options [Hash] page_margins The page margins for the worksheet
- def insert_worksheet(index=0, options={})
+ def insert_worksheet(index = 0, options = {})
worksheet = Worksheet.new(self, options)
@worksheets.delete_at(@worksheets.size - 1)
@worksheets.insert(index, worksheet)
@@ -312,7 +312,7 @@ require 'axlsx/workbook/worksheet/selection.rb'
# @option options [String] name The name of the worksheet.
# @option options [Hash] page_margins The page margins for the worksheet.
# @see Worksheet#initialize
- def add_worksheet(options={})
+ def add_worksheet(options = {})
worksheet = Worksheet.new(self, options)
yield worksheet if block_given?
worksheet
@@ -322,7 +322,7 @@ require 'axlsx/workbook/worksheet/selection.rb'
# @return WorkbookViews
# @option options [Hash] options passed into the added WorkbookView
# @see WorkbookView#initialize
- def add_view(options={})
+ def add_view(options = {})
views << WorkbookView.new(options)
end
@@ -339,10 +339,10 @@ require 'axlsx/workbook/worksheet/selection.rb'
def relationships
r = Relationships.new
@worksheets.each do |sheet|
- r << Relationship.new(sheet, WORKSHEET_R, WORKSHEET_PN % (r.size+1))
+ r << Relationship.new(sheet, WORKSHEET_R, WORKSHEET_PN % (r.size + 1))
end
pivot_tables.each_with_index do |pivot_table, index|
- r << Relationship.new(pivot_table.cache_definition, PIVOT_TABLE_CACHE_DEFINITION_R, PIVOT_TABLE_CACHE_DEFINITION_PN % (index+1))
+ r << Relationship.new(pivot_table.cache_definition, PIVOT_TABLE_CACHE_DEFINITION_R, PIVOT_TABLE_CACHE_DEFINITION_PN % (index + 1))
end
r << Relationship.new(self, STYLES_R, STYLES_PN)
if use_shared_strings
@@ -383,13 +383,13 @@ require 'axlsx/workbook/worksheet/selection.rb'
sheet_name = cell_def.split('!')[0] if cell_def.match('!')
worksheet = self.worksheets.select { |s| s.name == sheet_name }.first
raise ArgumentError, 'Unknown Sheet' unless sheet_name && worksheet.is_a?(Worksheet)
- worksheet[cell_def.gsub(/.+!/,"")]
+ worksheet[cell_def.gsub(/.+!/, "")]
end
# Serialize the workbook
# @param [String] str
# @return [String]
- def to_xml_string(str='')
+ def to_xml_string(str = '')
add_worksheet(name: 'Sheet1') unless worksheets.size > 0
str << '<?xml version="1.0" encoding="UTF-8"?>'
str << ('<workbook xmlns="' << XML_NS << '" xmlns:r="' << XML_NS_R << '">')
diff --git a/lib/axlsx/workbook/workbook_view.rb b/lib/axlsx/workbook/workbook_view.rb
index b2656d00..5b6d5bfb 100644
--- a/lib/axlsx/workbook/workbook_view.rb
+++ b/lib/axlsx/workbook/workbook_view.rb
@@ -44,7 +44,7 @@ module Axlsx
# @option [Integer] window_width Specifies the width of the workbook window. The unit of measurement for this value is twips.
# @option [Integer] window_height Specifies the height of the workbook window. The unit of measurement for this value is twips.
# @option [Boolean] auto_filter_date_grouping Specifies a boolean value that indicates whether to group dates when presenting the user with filtering options in the user interface.
- def initialize(options={})
+ def initialize(options = {})
parse_options options
yield self if block_given?
end
diff --git a/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb b/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb
index fa0716a2..ac630f69 100644
--- a/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb
+++ b/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb
@@ -24,7 +24,7 @@ module Axlsx
# @return [String]
def defined_name
return unless range
- Axlsx.cell_range(range.split(':').collect { |name| worksheet.name_to_cell(name)})
+ Axlsx.cell_range(range.split(':').collect { |name| worksheet.name_to_cell(name) })
end
# A collection of filterColumns for this auto_filter
@@ -51,7 +51,7 @@ module Axlsx
start_point = Axlsx::name_to_indices(first_cell)
end_point = Axlsx::name_to_indices(last_cell)
# The +1 is so we skip the header row with the filter drop downs
- rows = worksheet.rows[(start_point.last+1)..end_point.last] || []
+ rows = worksheet.rows[(start_point.last + 1)..end_point.last] || []
column_offset = start_point.first
columns.each do |column|
@@ -64,7 +64,7 @@ module Axlsx
# serialize the object
# @return [String]
- def to_xml_string(str='')
+ def to_xml_string(str = '')
return unless range
str << "<autoFilter ref='#{range}'>"
columns.each { |filter_column| filter_column.to_xml_string(str) }
diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb b/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb
index 54d43acf..1fa2ff78 100644
--- a/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb
+++ b/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb
@@ -26,7 +26,7 @@ module Axlsx
serializable_attributes :col_id, :hidden_button, :show_button
# Allowed filters
- FILTERS = [:filters] #, :top10, :custom_filters, :dynamic_filters, :color_filters, :icon_filters]
+ FILTERS = [:filters] #, :top10, :custom_filters, :dynamic_filters, :color_filters, :icon_filters]
# Zero-based index indicating the AutoFilter column to which this filter information applies.
# @return [Integer]
@@ -64,7 +64,7 @@ module Axlsx
# @param [Array] row A row from a worksheet that needs to be
# filtered.
def apply(row, offset)
- row.hidden = @filter.apply(row.cells[offset+col_id.to_i])
+ row.hidden = @filter.apply(row.cells[offset + col_id.to_i])
end
# @param [Boolean] hidden Flag indicating whether the AutoFilter button for this column is hidden.
@@ -85,7 +85,7 @@ module Axlsx
end
# Serialize the object to xml
- def to_xml_string(str='')
+ def to_xml_string(str = '')
str << "<filterColumn #{serialized_attributes}>"
@filter.to_xml_string(str)
str << "</filterColumn>"
diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb
index 7b503acd..da43a471 100644
--- a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb
+++ b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb
@@ -15,7 +15,7 @@ module Axlsx
# @note The recommended way to interact with filter objects is via AutoFilter#add_column
# @example
# ws.auto_filter.add_column(0, :filters, :blank => true, :calendar_type => 'japan', :filter_items => [100, 'a'])
- def initialize(options={})
+ def initialize(options = {})
parse_options options
end
@@ -141,7 +141,7 @@ include Axlsx::SerializedAttributes
# @option [Integer] hour @see hour
# @option [Integer] minute @see minute
# @option [Integer] second @see second
- def initialize(options={})
+ def initialize(options = {})
raise ArgumentError, "You must specify a year for date time grouping" unless options[:year]
raise ArgumentError, "You must specify a date_time_grouping when creating a DateGroupItem for auto filter" unless options[:date_time_grouping]
parse_options options
diff --git a/lib/axlsx/workbook/worksheet/border_creator.rb b/lib/axlsx/workbook/worksheet/border_creator.rb
index 2dcbdf0f..0e2fa87b 100644
--- a/lib/axlsx/workbook/worksheet/border_creator.rb
+++ b/lib/axlsx/workbook/worksheet/border_creator.rb
@@ -13,7 +13,7 @@ module Axlsx
elsif [email protected]_a?(Array)
raise ArgumentError.new("Invalid edges provided, #{@edges}")
else
- @edges = @edges.map{|x| x&.to_sym}.uniq
+ @edges = @edges.map { |x| x&.to_sym }.uniq
if !(@edges - Axlsx::Border::EDGES).empty?
raise ArgumentError.new("Invalid edges provided, #{edges}")
@@ -26,7 +26,7 @@ module Axlsx
@worksheet.add_style(
first_cell,
{
- border: {style: @style, color: @color, edges: @edges}
+ border: { style: @style, color: @color, edges: @edges }
}
)
else
@@ -34,7 +34,7 @@ module Axlsx
@worksheet.add_style(
border_cells[edge],
{
- border: {style: @style, color: @color, edges: [edge]}
+ border: { style: @style, color: @color, edges: [edge] }
}
)
end
diff --git a/lib/axlsx/workbook/worksheet/break.rb b/lib/axlsx/workbook/worksheet/break.rb
index a9e5fb11..f8cc452e 100644
--- a/lib/axlsx/workbook/worksheet/break.rb
+++ b/lib/axlsx/workbook/worksheet/break.rb
@@ -13,7 +13,7 @@ module Axlsx
# @option options [Integer] max Zero-based index of end row or column of the break. For row breaks, specifies column index; for column breaks, specifies row index.
# @option options [Boolean] man Manual Break flag. 1 means the break is a manually inserted break.
# @option option [Boolean] pt Flag indicating that a PivotTable created this break.
- def initialize(options={})
+ def initialize(options = {})
parse_options options
yield self if block_given?
end
@@ -25,7 +25,7 @@ module Axlsx
serializable_attributes :id, :min, :max, :man, :pt
# serializes the break to xml
- def to_xml_string(str='')
+ def to_xml_string(str = '')
serialized_tag('brk', str)
end
end
diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb
index 725b1a39..a9685dac 100644
--- a/lib/axlsx/workbook/worksheet/cell.rb
+++ b/lib/axlsx/workbook/worksheet/cell.rb
@@ -289,7 +289,7 @@ module Axlsx
# @param [String] v The 8 character representation for an rgb color #FFFFFFFF"
def color=(v)
- @color = v.is_a?(Color) ? v : Color.new(:rgb=>v)
+ @color = v.is_a?(Color) ? v : Color.new(:rgb => v)
@is_text_run = true
end
@@ -342,7 +342,7 @@ module Axlsx
# @example Absolute Cell Reference
# ws.rows.first.cells.first.r #=> "$A$1"
def r_abs
- "$#{r.match(%r{([A-Z]+)([0-9]+)})[1,2].join('$')}"
+ "$#{r.match(%r{([A-Z]+)([0-9]+)})[1, 2].join('$')}"
end
# @return [Integer] The cellXfs item index applied to this cell.
@@ -395,7 +395,7 @@ module Axlsx
# @param [Boolean] absolute -when false a relative reference will be
# returned.
# @return [String]
- def reference(absolute=true)
+ def reference(absolute = true)
absolute ? r_abs : r
end
diff --git a/lib/axlsx/workbook/worksheet/cell_serializer.rb b/lib/axlsx/workbook/worksheet/cell_serializer.rb
index b1ac8207..15113fcd 100644
--- a/lib/axlsx/workbook/worksheet/cell_serializer.rb
+++ b/lib/axlsx/workbook/worksheet/cell_serializer.rb
@@ -7,7 +7,7 @@ module Axlsx
# @param [Integer] column_index The index of the cell's column
# @param [String] str The string to apend serialization to.
# @return [String]
- def to_xml_string(row_index, column_index, cell, str='')
+ def to_xml_string(row_index, column_index, cell, str = '')
str << ('<c r="' << Axlsx::cell_r(column_index, row_index) << '" s="' << cell.style.to_s << '" ')
return str << '/>' if cell.value.nil?
method = cell.type
@@ -21,7 +21,7 @@ module Axlsx
def run_xml_string(cell, str = '')
if cell.is_text_run?
valid = RichTextRun::INLINE_STYLES - [:value, :type]
- data = Hash[Axlsx.instance_values_for(cell).map{ |k, v| [k.to_sym, v] }]
+ data = Hash[Axlsx.instance_values_for(cell).map { |k, v| [k.to_sym, v] }]
data = data.select { |key, value| valid.include?(key) && !value.nil? }
RichText.new(cell.value.to_s, data).to_xml_string(str)
elsif cell.contains_rich_text?
@@ -36,7 +36,7 @@ module Axlsx
# @param [Cell] cell The cell that is being serialized
# @param [String] str The string the serialized content will be appended to.
# @return [String]
- def iso_8601(cell, str='')
+ def iso_8601(cell, str = '')
value_serialization 'd', cell.value, str
end
@@ -44,7 +44,7 @@ module Axlsx
# @param [Cell] cell The cell that is being serialized
# @param [String] str The string the serialized content will be appended to.
# @return [String]
- def date(cell, str='')
+ def date(cell, str = '')
value_serialization false, DateTimeConverter::date_to_serial(cell.value).to_s, str
end
@@ -52,7 +52,7 @@ module Axlsx
# @param [Cell] cell The cell that is being serialized
# @param [String] str The string the serialized content will be appended to.
# @return [String]
- def time(cell, str='')
+ def time(cell, str = '')
value_serialization false, DateTimeConverter::time_to_serial(cell.value).to_s, str
end
@@ -60,7 +60,7 @@ module Axlsx
# @param [Cell] cell The cell that is being serialized
# @param [String] str The string the serialized content will be appended to.
# @return [String]
- def boolean(cell, str='')
+ def boolean(cell, str = '')
value_serialization 'b', cell.value.to_s, str
end
@@ -68,7 +68,7 @@ module Axlsx
# @param [Cell] cell The cell that is being serialized
# @param [String] str The string the serialized content will be appended to.
# @return [String]
- def float(cell, str='')
+ def float(cell, str = '')
numeric cell, str
end
@@ -84,7 +84,7 @@ module Axlsx
# @param [Cell] cell The cell that is being serialized
# @param [String] str The string the serialized content will be appended to.
# @return [String]
- def formula_serialization(cell, str='')
+ def formula_serialization(cell, str = '')
str << ('t="str"><f>' << cell.clean_value.to_s.sub('=', '') << '</f>')
str << ('<v>' << cell.formula_value.to_s << '</v>') unless cell.formula_value.nil?
end
@@ -93,7 +93,7 @@ module Axlsx
# @param [Cell] cell The cell that is being serialized
# @param [String] str The string the serialized content will be appended to.
# @return [String]
- def array_formula_serialization(cell, str='')
+ def array_formula_serialization(cell, str = '')
str << ('t="str">' << '<f t="array" ref="' << cell.r << '">' << cell.clean_value.to_s.sub('{=', '').sub(/}$/, '') << '</f>')
str << ('<v>' << cell.formula_value.to_s << '</v>') unless cell.formula_value.nil?
end
@@ -112,7 +112,7 @@ module Axlsx
# @param [Cell] cell The cell that is being serialized
# @param [String] str The string the serialized content will be appended to.
# @return [String]
- def string(cell, str='')
+ def string(cell, str = '')
if cell.is_array_formula?
array_formula_serialization cell, str
elsif cell.is_formula?
diff --git a/lib/axlsx/workbook/worksheet/cfvo.rb b/lib/axlsx/workbook/worksheet/cfvo.rb
index c9eb8d3d..773745f4 100644
--- a/lib/axlsx/workbook/worksheet/cfvo.rb
+++ b/lib/axlsx/workbook/worksheet/cfvo.rb
@@ -14,7 +14,7 @@ module Axlsx
# @option options [Symbol] type The type of conditional formatting value object
# @option options [Boolean] gte threshold value usage indicator
# @option options [String] val The value of the conditional formatting object
- def initialize(options={})
+ def initialize(options = {})
@gte = true
parse_options options
end
diff --git a/lib/axlsx/workbook/worksheet/cfvos.rb b/lib/axlsx/workbook/worksheet/cfvos.rb
index 2fc2e65a..44db4dfd 100644
--- a/lib/axlsx/workbook/worksheet/cfvos.rb
+++ b/lib/axlsx/workbook/worksheet/cfvos.rb
@@ -9,7 +9,7 @@ module Axlsx
# Serialize the Cfvo object
# @param [String] str
# @return [String]
- def to_xml_string(str='')
+ def to_xml_string(str = '')
each { |cfvo| cfvo.to_xml_string(str) }
end
end
diff --git a/lib/axlsx/workbook/worksheet/col.rb b/lib/axlsx/workbook/worksheet/col.rb
index 6305b8c9..0b39024f 100644
--- a/lib/axlsx/workbook/worksheet/col.rb
+++ b/lib/axlsx/workbook/worksheet/col.rb
@@ -16,7 +16,7 @@ module Axlsx
# @option options [Boolean] phonetic see Col#phonetic
# @option options [Integer] style see Col#style
# @option options [Numeric] width see Col#width
- def initialize(min, max, options={})
+ def initialize(min, max, options = {})
Axlsx.validate_unsigned_int(max)
Axlsx.validate_unsigned_int(min)
@min = min
diff --git a/lib/axlsx/workbook/worksheet/col_breaks.rb b/lib/axlsx/workbook/worksheet/col_breaks.rb
index df7da37b..763e4268 100644
--- a/lib/axlsx/workbook/worksheet/col_breaks.rb
+++ b/lib/axlsx/workbook/worksheet/col_breaks.rb
@@ -23,7 +23,7 @@ module Axlsx
# <colBreaks count="1" manualBreakCount="1">
# <brk id="3" max="1048575" man="1"/>
# </colBreaks>
- def to_xml_string(str='')
+ def to_xml_string(str = '')
return if empty?
str << ('<colBreaks count="' << size.to_s << '" manualBreakCount="' << size.to_s << '">')
each { |brk| brk.to_xml_string(str) }
diff --git a/lib/axlsx/workbook/worksheet/color_scale.rb b/lib/axlsx/workbook/worksheet/color_scale.rb
index 60b0e183..75877915 100644
--- a/lib/axlsx/workbook/worksheet/color_scale.rb
+++ b/lib/axlsx/workbook/worksheet/color_scale.rb
@@ -10,8 +10,8 @@ module Axlsx
# These are the default conditional formatting value objects
# that define a two tone color gradient.
def default_cfvos
- [{:type => :min, :val => 0, :color => 'FFFF7128'},
- {:type => :max, :val => 0, :color => 'FFFFEF9C'}]
+ [{ :type => :min, :val => 0, :color => 'FFFF7128' },
+ { :type => :max, :val => 0, :color => 'FFFFEF9C' }]
end
# A builder for two tone color gradient
@@ -29,9 +29,9 @@ module Axlsx
# color_scale = Axlsx::ColorScale.three_tone
# @see examples/example.rb conditional formatting examples.
def three_tone
- self.new({:type => :min, :val => 0, :color => 'FFF8696B'},
- {:type => :percent, :val => '50', :color => 'FFFFEB84'},
- {:type => :max, :val => 0, :color => 'FF63BE7B'})
+ self.new({ :type => :min, :val => 0, :color => 'FFF8696B' },
+ { :type => :percent, :val => '50', :color => 'FFFFEB84' },
+ { :type => :max, :val => 0, :color => 'FF63BE7B' })
end
end
# A simple typed list of cfvos
@@ -65,16 +65,16 @@ module Axlsx
# @option [Symbol] type The type of cfvo you to add
# @option [Any] val The value of the cfvo to add
# @option [String] The rgb color for the cfvo
- def add(options={})
+ def add(options = {})
value_objects << Cfvo.new(:type => options[:type] || :min, :val => options[:val] || 0)
colors << Color.new(:rgb => options[:color] || "FF000000")
- {:cfvo => value_objects.last, :color => colors.last}
+ { :cfvo => value_objects.last, :color => colors.last }
end
# removes the cfvo and color pair at the index specified.
# @param [Integer] index The index of the cfvo and color object to delete
# @note you cannot remove the first two cfvo and color pairs
- def delete_at(index=2)
+ def delete_at(index = 2)
value_objects.delete_at index
colors.delete_at index
end
diff --git a/lib/axlsx/workbook/worksheet/comment.rb b/lib/axlsx/workbook/worksheet/comment.rb
index 9efdb1f0..c2c94219 100644
--- a/lib/axlsx/workbook/worksheet/comment.rb
+++ b/lib/axlsx/workbook/worksheet/comment.rb
@@ -11,7 +11,7 @@ module Axlsx
# @option [String] text The text for the comment
# @option [String] ref The refence (e.g. 'A3' where this comment will be anchored.
# @option [Boolean] visible This controls the visiblity of the associated vml_shape.
- def initialize(comments, options={})
+ def initialize(comments, options = {})
raise ArgumentError, "A comment needs a parent comments object" unless comments.is_a?(Comments)
@visible = true
@comments = comments
diff --git a/lib/axlsx/workbook/worksheet/comments.rb b/lib/axlsx/workbook/worksheet/comments.rb
index 71a58c46..3ec2ba01 100644
--- a/lib/axlsx/workbook/worksheet/comments.rb
+++ b/lib/axlsx/workbook/worksheet/comments.rb
@@ -18,7 +18,7 @@ module Axlsx
# The part name for this object
# @return [String]
def pn
- "#{COMMENT_PN % (index+1)}"
+ "#{COMMENT_PN % (index + 1)}"
end
# Creates a new Comments object
@@ -35,7 +35,7 @@ module Axlsx
# @option options [String] author The name of the author for this comment
# @option options [String] text The text for this comment
# @option options [Stirng|Cell] ref The cell that this comment is attached to.
- def add_comment(options={})
+ def add_comment(options = {})
raise ArgumentError, "Comment require an author" unless options[:author]
raise ArgumentError, "Comment requires text" unless options[:text]
raise ArgumentError, "Comment requires ref" unless options[:ref]
@@ -60,7 +60,7 @@ module Axlsx
# serialize the object
# @param [String] str
# @return [String]
- def to_xml_string(str="")
+ def to_xml_string(str = "")
str << '<?xml version="1.0" encoding="UTF-8"?>'
str << ('<comments xmlns="' << XML_NS << '"><authors>')
authors.each do |author|
diff --git a/lib/axlsx/workbook/worksheet/conditional_formatting.rb b/lib/axlsx/workbook/worksheet/conditional_formatting.rb
index 2ff13682..c13113a5 100644
--- a/lib/axlsx/workbook/worksheet/conditional_formatting.rb
+++ b/lib/axlsx/workbook/worksheet/conditional_formatting.rb
@@ -10,7 +10,7 @@ module Axlsx
# Creates a new {ConditionalFormatting} object
# @option options [Array] rules The rules to apply
# @option options [String] sqref The range to apply the rules to
- def initialize(options={})
+ def initialize(options = {})
@rules = []
parse_options options
end
@@ -74,7 +74,7 @@ module Axlsx
# @return [String]
def to_xml_string(str = '')
str << ('<conditionalFormatting sqref="' << sqref << '">')
- str << rules.collect{ |rule| rule.to_xml_string }.join(' ')
+ str << rules.collect { |rule| rule.to_xml_string }.join(' ')
str << '</conditionalFormatting>'
end
end
diff --git a/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb b/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb
index de1c4032..4f84080b 100644
--- a/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb
+++ b/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb
@@ -24,7 +24,7 @@ module Axlsx
# @option options [Boolean] stopIfTrue Stop evaluating rules after this rule matches
# @option options [Symbol] timePeriod The time period in a date occuring... rule
# @option options [String] formula The formula to match against in i.e. an equal rule. Use a [minimum, maximum] array for cellIs between/notBetween conditionals.
- def initialize(options={})
+ def initialize(options = {})
@color_scale = @data_bar = @icon_set = @formula = nil
parse_options options
end
@@ -179,7 +179,7 @@ module Axlsx
# @see timePeriod
def timePeriod=(v); Axlsx::validate_time_period_type(v); @timePeriod = v end
# @see formula
- def formula=(v); [*v].each {|x| Axlsx::validate_string(x) }; @formula = [*v].map { |form| ::CGI.escapeHTML(form) } end
+ def formula=(v); [*v].each { |x| Axlsx::validate_string(x) }; @formula = [*v].map { |form| ::CGI.escapeHTML(form) } end
# @see color_scale
def color_scale=(v)
diff --git a/lib/axlsx/workbook/worksheet/data_bar.rb b/lib/axlsx/workbook/worksheet/data_bar.rb
index c89c421d..1ff65fd5 100644
--- a/lib/axlsx/workbook/worksheet/data_bar.rb
+++ b/lib/axlsx/workbook/worksheet/data_bar.rb
@@ -12,8 +12,8 @@ module Axlsx
class << self
# This differs from ColorScale. There must be exactly two cfvos one color
def default_cfvos
- [{:type => :min, :val => "0"},
- {:type => :max, :val => "0"}]
+ [{ :type => :min, :val => "0" },
+ { :type => :max, :val => "0" }]
end
end
@@ -105,7 +105,7 @@ module Axlsx
# Serialize this object to an xml string
# @param [String] str
# @return [String]
- def to_xml_string(str="")
+ def to_xml_string(str = "")
serialized_tag('dataBar', str) do
value_objects.to_xml_string(str)
self.color.to_xml_string(str)
diff --git a/lib/axlsx/workbook/worksheet/data_validation.rb b/lib/axlsx/workbook/worksheet/data_validation.rb
index d4b86e20..741dee86 100644
--- a/lib/axlsx/workbook/worksheet/data_validation.rb
+++ b/lib/axlsx/workbook/worksheet/data_validation.rb
@@ -22,7 +22,7 @@ module Axlsx
# @option options [Boolean] showInputMessage - A boolean value indicating whether to display the input prompt message.
# @option options [String] sqref - Range over which data validation is applied, in "A1:B2" format.
# @option options [Symbol] type - The type of data validation.
- def initialize(options={})
+ def initialize(options = {})
# defaults
@formula1 = @formula2 = @error = @errorTitle = @operator = @prompt = @promptTitle = @sqref = nil
@allowBlank = @showErrorMessage = true
diff --git a/lib/axlsx/workbook/worksheet/date_time_converter.rb b/lib/axlsx/workbook/worksheet/date_time_converter.rb
index 48d69d94..ff85c64f 100644
--- a/lib/axlsx/workbook/worksheet/date_time_converter.rb
+++ b/lib/axlsx/workbook/worksheet/date_time_converter.rb
@@ -22,7 +22,7 @@ module Axlsx
epoch1904 = -2082844800.0 # Time.utc(1904, 1, 1).to_i
seconds_per_day = 86400.0 # 60*60*24
epoch = Axlsx::Workbook::date1904 ? epoch1904 : epoch1900
- (time.utc_offset + time.to_f - epoch)/seconds_per_day
+ (time.utc_offset + time.to_f - epoch) / seconds_per_day
end
end
end
diff --git a/lib/axlsx/workbook/worksheet/icon_set.rb b/lib/axlsx/workbook/worksheet/icon_set.rb
index 0042e757..4e7064e9 100644
--- a/lib/axlsx/workbook/worksheet/icon_set.rb
+++ b/lib/axlsx/workbook/worksheet/icon_set.rb
@@ -61,7 +61,7 @@ module Axlsx
# Serialize this object to an xml string
# @param [String] str
# @return [String]
- def to_xml_string(str="")
+ def to_xml_string(str = "")
serialized_tag('iconSet', str) do
@value_objects.each { |cfvo| cfvo.to_xml_string(str) }
end
diff --git a/lib/axlsx/workbook/worksheet/page_margins.rb b/lib/axlsx/workbook/worksheet/page_margins.rb
index 2dec65e6..de0d099b 100644
--- a/lib/axlsx/workbook/worksheet/page_margins.rb
+++ b/lib/axlsx/workbook/worksheet/page_margins.rb
@@ -19,7 +19,7 @@ module Axlsx
# @option options [Numeric] top The top margin in inches
# @option options [Numeric] header The header margin in inches
# @option options [Numeric] footer The footer margin in inches
- def initialize(options={})
+ def initialize(options = {})
# Default values taken from MS Excel for Mac 2011
@left = @right = DEFAULT_LEFT_RIGHT
@top = @bottom = DEFAULT_TOP_BOTTOM
diff --git a/lib/axlsx/workbook/worksheet/page_set_up_pr.rb b/lib/axlsx/workbook/worksheet/page_set_up_pr.rb
index 2242f2bc..819c5fa7 100644
--- a/lib/axlsx/workbook/worksheet/page_set_up_pr.rb
+++ b/lib/axlsx/workbook/worksheet/page_set_up_pr.rb
@@ -35,7 +35,7 @@ module Axlsx
end
# serialize to xml
- def to_xml_string(str='')
+ def to_xml_string(str = '')
str << ('<pageSetUpPr ' << serialized_attributes << '/>')
end
end
diff --git a/lib/axlsx/workbook/worksheet/page_setup.rb b/lib/axlsx/workbook/worksheet/page_setup.rb
index 6281eb74..07dd6817 100644
--- a/lib/axlsx/workbook/worksheet/page_setup.rb
+++ b/lib/axlsx/workbook/worksheet/page_setup.rb
@@ -213,7 +213,7 @@ module Axlsx
# @note This method will overwrite any value you explicitly set via the fit_to_height or fit_to_width methods.
# @option options [Integer] width The number of pages to fit this worksheet on horizontally. Default 999
# @option options [Integer] height The number of pages to fit this worksheet on vertically. Default 999
- def fit_to(options={})
+ def fit_to(options = {})
self.fit_to_width = options[:width] || 999
self.fit_to_height = options[:height] || 999
[@fit_to_width, @fit_to_height]
diff --git a/lib/axlsx/workbook/worksheet/pane.rb b/lib/axlsx/workbook/worksheet/pane.rb
index 9acfa14b..f9323d3e 100644
--- a/lib/axlsx/workbook/worksheet/pane.rb
+++ b/lib/axlsx/workbook/worksheet/pane.rb
@@ -12,7 +12,7 @@ module Axlsx
# @option options [Cell, String] top_left_cell Top Left Visible Cell
# @option options [Integer] x_split Horizontal Split Position
# @option options [Integer] y_split Vertical Split Position
- def initialize(options={})
+ def initialize(options = {})
#defaults
@active_pane = @state = @top_left_cell = nil
@x_split = @y_split = 0
@@ -131,7 +131,7 @@ module Axlsx
if @state == 'frozen' && @top_left_cell.nil?
row = @y_split || 0
column = @x_split || 0
- @top_left_cell = "#{('A'..'ZZ').to_a[column]}#{row+1}"
+ @top_left_cell = "#{('A'..'ZZ').to_a[column]}#{row + 1}"
end
end
end
diff --git a/lib/axlsx/workbook/worksheet/pivot_table.rb b/lib/axlsx/workbook/worksheet/pivot_table.rb
index ed51d5cf..ff131dfb 100644
--- a/lib/axlsx/workbook/worksheet/pivot_table.rb
+++ b/lib/axlsx/workbook/worksheet/pivot_table.rb
@@ -11,12 +11,12 @@ module Axlsx
# @param [Worksheet] sheet The sheet containing the table data.
# @option options [Cell, String] name
# @option options [TableStyle] style
- def initialize(ref, range, sheet, options={})
+ def initialize(ref, range, sheet, options = {})
@ref = ref
self.range = range
@sheet = sheet
@sheet.workbook.pivot_tables << self
- @name = "PivotTable#{index+1}"
+ @name = "PivotTable#{index + 1}"
@data_sheet = nil
@rows = []
@columns = []
@@ -122,7 +122,7 @@ module Axlsx
@data = []
v.each do |data_field|
if data_field.is_a? String
- data_field = {:ref => data_field}
+ data_field = { :ref => data_field }
end
data_field.each do |key, value|
if key == :num_fmt
@@ -158,13 +158,13 @@ module Axlsx
# The part name for this table
# @return [String]
def pn
- "#{PIVOT_TABLE_PN % (index+1)}"
+ "#{PIVOT_TABLE_PN % (index + 1)}"
end
# The relationship part name of this pivot table
# @return [String]
def rels_pn
- "#{PIVOT_TABLE_RELS_PN % (index+1)}"
+ "#{PIVOT_TABLE_RELS_PN % (index + 1)}"
end
# The cache_definition for this pivot table
@@ -219,7 +219,7 @@ module Axlsx
str << '<colFields count="1"><field x="-2"/></colFields>'
str << "<colItems count=\"#{data.size}\">"
str << '<i><x/></i>'
- data[1..-1].each_with_index do |datum_value,i|
+ data[1..-1].each_with_index do |datum_value, i|
str << "<i i=\"#{i + 1}\"><x v=\"#{i + 1}\"/></i>"
end
str << '</colItems>'
@@ -244,7 +244,7 @@ module Axlsx
str << "<dataFields count=\"#{data.size}\">"
data.each do |datum_value|
# The correct name prefix in ["Sum","Average", etc...]
- str << "<dataField name='#{(datum_value[:subtotal]||'')} of #{datum_value[:ref]}' fld='#{header_index_of(datum_value[:ref])}' baseField='0' baseItem='0'"
+ str << "<dataField name='#{(datum_value[:subtotal] || '')} of #{datum_value[:ref]}' fld='#{header_index_of(datum_value[:ref])}' baseField='0' baseItem='0'"
str << " numFmtId='#{datum_value[:num_fmt]}'" if datum_value[:num_fmt]
str << " subtotal='#{datum_value[:subtotal]}' " if datum_value[:subtotal]
str << "/>"
@@ -254,7 +254,7 @@ module Axlsx
# custom pivot table style
unless style_info.empty?
str << '<pivotTableStyleInfo'
- style_info.each do |k,v|
+ style_info.each do |k, v|
str << ' ' << k.to_s << '="' << v.to_s << '"'
end
str << ' />'
diff --git a/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb b/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb
index 2c7c05e4..8813c84b 100644
--- a/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb
+++ b/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb
@@ -24,7 +24,7 @@ module Axlsx
# The part name for this table
# @return [String]
def pn
- "#{PIVOT_TABLE_CACHE_DEFINITION_PN % (index+1)}"
+ "#{PIVOT_TABLE_CACHE_DEFINITION_PN % (index + 1)}"
end
# The identifier for this cache
@@ -46,17 +46,17 @@ module Axlsx
def to_xml_string(str = '')
str << '<?xml version="1.0" encoding="UTF-8"?>'
str << ('<pivotCacheDefinition xmlns="' << XML_NS << '" xmlns:r="' << XML_NS_R << '" invalid="1" refreshOnLoad="1" recordCount="0">')
- str << '<cacheSource type="worksheet">'
- str << ( '<worksheetSource ref="' << pivot_table.range << '" sheet="' << pivot_table.data_sheet.name << '"/>')
- str << '</cacheSource>'
- str << ( '<cacheFields count="' << pivot_table.header_cells_count.to_s << '">')
+ str << '<cacheSource type="worksheet">'
+ str << ('<worksheetSource ref="' << pivot_table.range << '" sheet="' << pivot_table.data_sheet.name << '"/>')
+ str << '</cacheSource>'
+ str << ('<cacheFields count="' << pivot_table.header_cells_count.to_s << '">')
pivot_table.header_cells.each do |cell|
- str << ( '<cacheField name="' << cell.clean_value << '" numFmtId="0">')
+ str << ('<cacheField name="' << cell.clean_value << '" numFmtId="0">')
str << '<sharedItems count="0">'
str << '</sharedItems>'
- str << '</cacheField>'
+ str << '</cacheField>'
end
- str << '</cacheFields>'
+ str << '</cacheFields>'
str << '</pivotCacheDefinition>'
end
end
diff --git a/lib/axlsx/workbook/worksheet/pivot_tables.rb b/lib/axlsx/workbook/worksheet/pivot_tables.rb
index 8aaebea2..018fc6a7 100644
--- a/lib/axlsx/workbook/worksheet/pivot_tables.rb
+++ b/lib/axlsx/workbook/worksheet/pivot_tables.rb
@@ -15,7 +15,7 @@ module Axlsx
# returns the relationships required by this collection
def relationships
return [] if empty?
- map{ |pivot_table| Relationship.new(pivot_table, PIVOT_TABLE_R, "../#{pivot_table.pn}") }
+ map { |pivot_table| Relationship.new(pivot_table, PIVOT_TABLE_R, "../#{pivot_table.pn}") }
end
end
end
diff --git a/lib/axlsx/workbook/worksheet/protected_range.rb b/lib/axlsx/workbook/worksheet/protected_range.rb
index 07f9a20c..e4eb83e5 100644
--- a/lib/axlsx/workbook/worksheet/protected_range.rb
+++ b/lib/axlsx/workbook/worksheet/protected_range.rb
@@ -9,7 +9,7 @@ module Axlsx
# Initializes a new protected range object
# @option [String] sqref The cell range reference to protect. This can be an absolute or a relateve range however, it only applies to the current sheet.
# @option [String] name An optional name for the protected name.
- def initialize(options={})
+ def initialize(options = {})
parse_options options
yield self if block_given?
end
@@ -39,7 +39,7 @@ module Axlsx
# @param [String] str if this string object is provided we append
# our output to that object. Use this - it helps limit the number of
# objects created during serialization
- def to_xml_string(str="")
+ def to_xml_string(str = "")
serialized_tag 'protectedRange', str
end
end
diff --git a/lib/axlsx/workbook/worksheet/rich_text.rb b/lib/axlsx/workbook/worksheet/rich_text.rb
index e5156047..4b643470 100644
--- a/lib/axlsx/workbook/worksheet/rich_text.rb
+++ b/lib/axlsx/workbook/worksheet/rich_text.rb
@@ -5,7 +5,7 @@ module Axlsx
# @param [String] text -optional The text to use in creating the first RichTextRun
# @param [Object] options -optional The options to use in creating the first RichTextRun
# @yield [RichText] self
- def initialize(text = nil, options={})
+ def initialize(text = nil, options = {})
super(RichTextRun)
add_run(text, options) unless text.nil?
yield self if block_given?
@@ -32,7 +32,7 @@ module Axlsx
# Creates and adds a RichTextRun to this collectino
# @param [String] text The text to use in creating a new RichTextRun
# @param [Object] options The options to use in creating the new RichTextRun
- def add_run(text, options={})
+ def add_run(text, options = {})
self << RichTextRun.new(text, options)
end
@@ -45,8 +45,8 @@ module Axlsx
# renders the RichTextRuns in this collection
# @param [String] str
# @return [String]
- def to_xml_string(str='')
- each{ |run| run.to_xml_string(str) }
+ def to_xml_string(str = '')
+ each { |run| run.to_xml_string(str) }
str
end
end
diff --git a/lib/axlsx/workbook/worksheet/rich_text_run.rb b/lib/axlsx/workbook/worksheet/rich_text_run.rb
index 44046709..368b10ce 100644
--- a/lib/axlsx/workbook/worksheet/rich_text_run.rb
+++ b/lib/axlsx/workbook/worksheet/rich_text_run.rb
@@ -11,7 +11,7 @@ module Axlsx
:shadow, :condense, :extend, :u,
:vertAlign, :sz, :color, :scheme].freeze
- def initialize(value, options={})
+ def initialize(value, options = {})
self.value = value
parse_options(options)
end
@@ -138,7 +138,7 @@ module Axlsx
# @param [String] v The 8 character representation for an rgb color #FFFFFFFF"
def color=(v)
- @color = v.is_a?(Color) ? v : Color.new(:rgb=>v)
+ @color = v.is_a?(Color) ? v : Color.new(:rgb => v)
end
# The inline sz property for the cell
@@ -203,7 +203,7 @@ module Axlsx
# @return [String]
def to_xml_string(str = '')
valid = RichTextRun::INLINE_STYLES
- data = Hash[Axlsx.instance_values_for(self).map{ |k, v| [k.to_sym, v] }]
+ data = Hash[Axlsx.instance_values_for(self).map { |k, v| [k.to_sym, v] }]
data = data.select { |key, value| valid.include?(key) && !value.nil? }
str << '<r><rPr>'
diff --git a/lib/axlsx/workbook/worksheet/row.rb b/lib/axlsx/workbook/worksheet/row.rb
index fc044124..453e1e66 100644
--- a/lib/axlsx/workbook/worksheet/row.rb
+++ b/lib/axlsx/workbook/worksheet/row.rb
@@ -27,7 +27,7 @@ module Axlsx
# @option options [Integer] offset - add empty columns before values
# @see Row#array_to_cells
# @see Cell
- def initialize(worksheet, values=[], options={})
+ def initialize(worksheet, values = [], options = {})
self.worksheet = worksheet
super(Cell, nil, values.size + options[:offset].to_i)
self.height = options.delete(:height)
@@ -134,7 +134,7 @@ module Axlsx
private
# assigns the owning worksheet for this row
- def worksheet=(v) DataTypeValidator.validate :row_worksheet, Worksheet, v; @worksheet=v; end
+ def worksheet=(v) DataTypeValidator.validate :row_worksheet, Worksheet, v; @worksheet = v; end
# Converts values, types, and style options into cells and associates them with this row.
# A new cell is created for each item in the values array.
@@ -145,7 +145,7 @@ module Axlsx
# @option options [Array] values
# @option options [Array, Symbol] types
# @option options [Array, Integer] style
- def array_to_cells(values, options={})
+ def array_to_cells(values, options = {})
DataTypeValidator.validate :array_to_cells, Array, values
types, style, formula_values, escape_formulas, offset = options.delete(:types), options.delete(:style), options.delete(:formula_values), options.delete(:escape_formulas), options.delete(:offset)
offset.to_i.times { |index| self[index] = Cell.new(self) } if offset
diff --git a/lib/axlsx/workbook/worksheet/row_breaks.rb b/lib/axlsx/workbook/worksheet/row_breaks.rb
index e4cbf4f2..b05e0587 100644
--- a/lib/axlsx/workbook/worksheet/row_breaks.rb
+++ b/lib/axlsx/workbook/worksheet/row_breaks.rb
@@ -21,7 +21,7 @@ module Axlsx
# <brk id="7" max="16383" man="1"/>
# <brk id="13" max="16383" man="1"/>
# </rowBreaks>
- def to_xml_string(str='')
+ def to_xml_string(str = '')
return if empty?
str << ('<rowBreaks count="' << self.size.to_s << '" manualBreakCount="' << self.size.to_s << '">')
each { |brk| brk.to_xml_string(str) }
diff --git a/lib/axlsx/workbook/worksheet/selection.rb b/lib/axlsx/workbook/worksheet/selection.rb
index efa56056..82538fce 100644
--- a/lib/axlsx/workbook/worksheet/selection.rb
+++ b/lib/axlsx/workbook/worksheet/selection.rb
@@ -12,7 +12,7 @@ module Axlsx
# @option options [Integer] active_cell_id Active Cell Index
# @option options [Symbol] pane Pane
# @option options [String] sqref Sequence of References
- def initialize(options={})
+ def initialize(options = {})
@active_cell = @active_cell_id = @pane = @sqref = nil
parse_options options
end
diff --git a/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb b/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb
index b42ecb31..58f630d4 100644
--- a/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb
+++ b/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb
@@ -8,7 +8,7 @@ module Axlsx
# creates a new SheetCalcPr
# @param [Hash] options Options for this object
# @option [Boolean] full_calc_on_load @see full_calc_on_load
- def initialize(options={})
+ def initialize(options = {})
@full_calc_on_load = true
parse_options options
end
@@ -21,7 +21,7 @@ module Axlsx
# @param [String] str the string to append this objects serialized
# content to.
# @return [String]
- def to_xml_string(str='')
+ def to_xml_string(str = '')
str << "<sheetCalcPr #{serialized_attributes}/>"
end
end
diff --git a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb
index de4c6e16..5e06ca5b 100644
--- a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb
+++ b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb
@@ -28,7 +28,7 @@ module Axlsx
# @option [Boolean] thick_bottom 'True' if rows have a thick bottom border by default.
# @option [Integer] outline_level_row Highest number of outline level for rows in this sheet. These values shall be in synch with the actual sheet outline levels.
# @option [Integer] outline_level_col Highest number of outline levels for columns in this sheet. These values shall be in synch with the actual sheet outline levels.
- def initialize(options={})
+ def initialize(options = {})
set_defaults
parse_options options
end
@@ -46,7 +46,7 @@ module Axlsx
# serializes this object to an xml string
# @param [String] str The string this objects serialization will be appended to
# @return [String]
- def to_xml_string(str='')
+ def to_xml_string(str = '')
str << "<sheetFormatPr #{serialized_attributes}/>"
end
diff --git a/lib/axlsx/workbook/worksheet/sheet_pr.rb b/lib/axlsx/workbook/worksheet/sheet_pr.rb
index 6f76b580..a870e4a3 100644
--- a/lib/axlsx/workbook/worksheet/sheet_pr.rb
+++ b/lib/axlsx/workbook/worksheet/sheet_pr.rb
@@ -29,7 +29,7 @@ module Axlsx
# Creates a new SheetPr object
# @param [Worksheet] worksheet The worksheet that owns this SheetPr object
- def initialize(worksheet, options={})
+ def initialize(worksheet, options = {})
raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet)
@worksheet = worksheet
@outline_pr = nil
diff --git a/lib/axlsx/workbook/worksheet/sheet_protection.rb b/lib/axlsx/workbook/worksheet/sheet_protection.rb
index c921d381..3ca17737 100644
--- a/lib/axlsx/workbook/worksheet/sheet_protection.rb
+++ b/lib/axlsx/workbook/worksheet/sheet_protection.rb
@@ -23,7 +23,7 @@ module Axlsx
# @option options [Boolean] pivot_tables @see SheetProtection#pivot_tables
# @option options [Boolean] select_unlocked_cells @see SheetProtection#select_unlocked_cells
# @option options [String] password. The password required for unlocking. @see SheetProtection#password=
- def initialize(options={})
+ def initialize(options = {})
@objects = @scenarios = @select_locked_cells = @select_unlocked_cells = false
@sheet = @format_cells = @format_rows = @format_columns = @insert_columns = @insert_rows = @insert_hyperlinks = @delete_columns = @delete_rows = @sort = @auto_filter = @pivot_tables = true
@password = nil
@@ -107,7 +107,7 @@ module Axlsx
char = low_15 | high_15
end
- encoded_password = 0x0000
+ encoded_password = 0x0000
chars.each { |c| encoded_password ^= c }
encoded_password ^= count
encoded_password ^= 0xCE4B
diff --git a/lib/axlsx/workbook/worksheet/sheet_view.rb b/lib/axlsx/workbook/worksheet/sheet_view.rb
index 17a547ea..ab66f800 100644
--- a/lib/axlsx/workbook/worksheet/sheet_view.rb
+++ b/lib/axlsx/workbook/worksheet/sheet_view.rb
@@ -28,7 +28,7 @@ module Axlsx
# @option options [Integer] zoom_scale_normal Zoom Scale Normal View
# @option options [Integer] zoom_scale_page_layout_view Zoom Scale Page Layout View
# @option options [Integer] zoom_scale_sheet_layout_view Zoom Scale Page Break Preview
- def initialize(options={})
+ def initialize(options = {})
#defaults
@color_id = @top_left_cell = @pane = nil
@right_to_left = @show_formulas = @show_outline_symbols = @show_white_space = @tab_selected = @window_protection = false
diff --git a/lib/axlsx/workbook/worksheet/table.rb b/lib/axlsx/workbook/worksheet/table.rb
index 5053c5fd..4f446491 100644
--- a/lib/axlsx/workbook/worksheet/table.rb
+++ b/lib/axlsx/workbook/worksheet/table.rb
@@ -10,13 +10,13 @@ module Axlsx
# @param [Worksheet] sheet The sheet containing the table data.
# @option options [Cell, String] name
# @option options [TableStyle] style
- def initialize(ref, sheet, options={})
+ def initialize(ref, sheet, options = {})
@ref = ref
@sheet = sheet
@style = nil
@sheet.workbook.tables << self
@table_style_info = TableStyleInfo.new(options[:style_info]) if options[:style_info]
- @name = "Table#{index+1}"
+ @name = "Table#{index + 1}"
parse_options options
yield self if block_given?
end
@@ -42,7 +42,7 @@ module Axlsx
# The part name for this table
# @return [String]
def pn
- "#{TABLE_PN % (index+1)}"
+ "#{TABLE_PN % (index + 1)}"
end
# The relationship id for this table.
@@ -73,12 +73,12 @@ module Axlsx
# @return [String]
def to_xml_string(str = '')
str << '<?xml version="1.0" encoding="UTF-8"?>'
- str << ('<table xmlns="' << XML_NS << '" id="' << (index+1).to_s << '" name="' << @name << '" displayName="' << @name.gsub(/\s/,'_') << '" ')
+ str << ('<table xmlns="' << XML_NS << '" id="' << (index + 1).to_s << '" name="' << @name << '" displayName="' << @name.gsub(/\s/, '_') << '" ')
str << ('ref="' << @ref << '" totalsRowShown="0">')
str << ('<autoFilter ref="' << @ref << '"/>')
str << ('<tableColumns count="' << header_cells.length.to_s << '">')
- header_cells.each_with_index do |cell,index|
- str << ('<tableColumn id ="' << (index+1).to_s << '" name="' << cell.clean_value << '"/>')
+ header_cells.each_with_index do |cell, index|
+ str << ('<tableColumn id ="' << (index + 1).to_s << '" name="' << cell.clean_value << '"/>')
end
str << '</tableColumns>'
table_style_info.to_xml_string(str)
diff --git a/lib/axlsx/workbook/worksheet/tables.rb b/lib/axlsx/workbook/worksheet/tables.rb
index bf6efe0c..69e59fe5 100644
--- a/lib/axlsx/workbook/worksheet/tables.rb
+++ b/lib/axlsx/workbook/worksheet/tables.rb
@@ -15,7 +15,7 @@ module Axlsx
# returns the relationships required by this collection
def relationships
return [] if empty?
- map{ |table| Relationship.new(table, TABLE_R, "../#{table.pn}") }
+ map { |table| Relationship.new(table, TABLE_R, "../#{table.pn}") }
end
# renders the tables xml
diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb
index c3960af3..18daaeeb 100644
--- a/lib/axlsx/workbook/worksheet/worksheet.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet.rb
@@ -14,7 +14,7 @@ module Axlsx
# @option options [Hash] print_options A hash containing print options for this worksheet. @see PrintOptions
# @option options [Hash] header_footer A hash containing header/footer options for this worksheet. @see HeaderFooter
# @option options [Boolean] show_gridlines indicates if gridlines should be shown for this sheet.
- def initialize(wb, options={})
+ def initialize(wb, options = {})
self.workbook = wb
@sheet_protection = nil
initialize_page_options(options)
@@ -40,7 +40,7 @@ module Axlsx
# The name of the worksheet
# @return [String]
def name
- @name ||= "Sheet" + (index+1).to_s
+ @name ||= "Sheet" + (index + 1).to_s
end
# Specifies the visible state of this sheet. Allowed states are
@@ -99,13 +99,13 @@ module Axlsx
# The tables in this worksheet
# @return [Array] of Table
def tables
- @tables ||= Tables.new self
+ @tables ||= Tables.new self
end
# The pivot tables in this worksheet
# @return [Array] of Table
def pivot_tables
- @pivot_tables ||= PivotTables.new self
+ @pivot_tables ||= PivotTables.new self
end
# A collection of column breaks added to this worksheet
@@ -307,7 +307,7 @@ module Axlsx
# @param [String] name
def name=(name)
validate_sheet_name name
- @name=Axlsx::coder.encode(name)
+ @name = Axlsx::coder.encode(name)
end
# The auto filter range for the worksheet
@@ -325,13 +325,13 @@ module Axlsx
# The part name of this worksheet
# @return [String]
def pn
- "#{WORKSHEET_PN % (index+1)}"
+ "#{WORKSHEET_PN % (index + 1)}"
end
# The relationship part name of this worksheet
# @return [String]
def rels_pn
- "#{WORKSHEET_RELS_PN % (index+1)}"
+ "#{WORKSHEET_RELS_PN % (index + 1)}"
end
# The relationship id of this worksheet.
@@ -408,7 +408,7 @@ module Axlsx
# sign as formula (default) or as simple string.
# Allowing user generated data to be interpreted as formulas can be dangerous
# (see https://www.owasp.org/index.php/CSV_Injection for details).
- def add_row(values=[], options={})
+ def add_row(values = [], options = {})
row = Row.new(self, values, options)
update_column_info row, options.delete(:widths)
yield row if block_given?
@@ -428,7 +428,7 @@ module Axlsx
# @see ConditionalFormattingRule#initialize
# @see file:examples/example_conditional_formatting.rb
def add_conditional_formatting(cells, rules)
- cf = ConditionalFormatting.new( :sqref => cells )
+ cf = ConditionalFormatting.new(:sqref => cells)
cf.add_rules rules
conditional_formattings << cf
conditional_formattings
@@ -449,7 +449,7 @@ module Axlsx
# @param [Hash] options for the hyperlink
# @see WorksheetHyperlink for a list of options
# @return [WorksheetHyperlink]
- def add_hyperlink(options={})
+ def add_hyperlink(options = {})
hyperlinks.add(options)
end
@@ -466,33 +466,33 @@ module Axlsx
# @see Bar3DChart
# @see Line3DChart
# @see README for examples
- def add_chart(chart_type, options={})
+ def add_chart(chart_type, options = {})
chart = worksheet_drawing.add_chart(chart_type, options)
yield chart if block_given?
chart
end
# needs documentation
- def add_table(ref, options={})
+ def add_table(ref, options = {})
tables << Table.new(ref, self, options)
yield tables.last if block_given?
tables.last
end
- def add_pivot_table(ref, range, options={})
+ def add_pivot_table(ref, range, options = {})
pivot_tables << PivotTable.new(ref, range, self, options)
yield pivot_tables.last if block_given?
pivot_tables.last
end
# Shortcut to worsksheet_comments#add_comment
- def add_comment(options={})
+ def add_comment(options = {})
worksheet_comments.add_comment(options)
end
# Adds a media item to the worksheets drawing
# @option [Hash] options options passed to drawing.add_image
- def add_image(options={})
+ def add_image(options = {})
image = worksheet_drawing.add_image(options)
yield image if block_given?
image
@@ -539,7 +539,7 @@ module Axlsx
# @note You can also specify the style for specific columns in the call to add_row by using an array for the :styles option
# @see Worksheet#add_row
# @see README.md for an example
- def col_style(index, style, options={})
+ def col_style(index, style, options = {})
offset = options.delete(:row_offset) || 0
cells = @rows[(offset..-1)].map { |row| row[index] }.flatten.compact
cells.each { |cell| cell.style = style }
@@ -553,7 +553,7 @@ module Axlsx
# @note You can also specify the style in the add_row call
# @see Worksheet#add_row
# @see README.md for an example
- def row_style(index, style, options={})
+ def row_style(index, style, options = {})
offset = options.delete(:col_offset) || 0
cells = cols[(offset..-1)].map { |column| column[index] }.flatten.compact
cells.each { |cell| cell.style = style }
@@ -583,7 +583,7 @@ module Axlsx
# Set the style for cells in a specific column
# @param [String|Array] cell references
# @param [Hash|Array|Symbol] border options
- def add_border(cell_refs, options=nil)
+ def add_border(cell_refs, options = nil)
if options.is_a?(Hash)
border_edges = options[:edges]
border_style = options[:style]
@@ -606,7 +606,7 @@ module Axlsx
end
# Returns a sheet node serialization for this sheet in the workbook.
- def to_sheet_node_xml_string(str='')
+ def to_sheet_node_xml_string(str = '')
add_autofilter_defined_name_to_workbook
str << '<sheet '
serialized_attributes str
@@ -617,7 +617,7 @@ module Axlsx
# Serializes the worksheet object to an xml string
# This intentionally does not use nokogiri for performance reasons
# @return [String]
- def to_xml_string str=''
+ def to_xml_string str = ''
add_autofilter_defined_name_to_workbook
auto_filter.apply if auto_filter.range
str << '<?xml version="1.0" encoding="UTF-8"?>'
@@ -646,7 +646,7 @@ module Axlsx
def [](cell_def)
return rows[cell_def] if cell_def.is_a?(Integer)
- parts = cell_def.split(':').map{ |part| name_to_cell part }
+ parts = cell_def.split(':').map { |part| name_to_cell part }
if parts.size == 1
parts.first
diff --git a/lib/axlsx/workbook/worksheet/worksheet_comments.rb b/lib/axlsx/workbook/worksheet/worksheet_comments.rb
index d8aed8e0..c40587ae 100644
--- a/lib/axlsx/workbook/worksheet/worksheet_comments.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet_comments.rb
@@ -20,7 +20,7 @@ module Axlsx
# Adds a comment
# @param [Hash] options
# @see Comments#add_comment
- def add_comment(options={})
+ def add_comment(options = {})
comments.add_comment(options)
end
@@ -41,7 +41,7 @@ module Axlsx
# @see Relationship#Id
# @return [String]
def drawing_rId
- comments.relationships.find{ |r| r.Type == VML_DRAWING_R }.Id
+ comments.relationships.find { |r| r.Type == VML_DRAWING_R }.Id
end
# Seraalize the object
diff --git a/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb b/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb
index f79bc814..bda87995 100644
--- a/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb
@@ -13,7 +13,7 @@ module Axlsx
# @option [String] tooltip The tip to display when the user positions the mouse cursor over this hyperlink
# @option [Symbol] target This is :external by default. If you set it to anything else, the location is interpreted to be the current workbook.
# @option [String|Cell] ref The location of this hyperlink in the worksheet
- def initialize(worksheet, options={})
+ def initialize(worksheet, options = {})
DataTypeValidator.validate "Hyperlink.worksheet", [Worksheet], worksheet
@worksheet = worksheet
@target = :external
@@ -55,7 +55,7 @@ module Axlsx
# Seralize the object
# @param [String] str
# @return [String]
- def to_xml_string(str='')
+ def to_xml_string(str = '')
str << '<hyperlink '
serialized_attributes str, location_or_id
str << '/>'
@@ -66,7 +66,7 @@ module Axlsx
# r:id should only be specified for external targets.
# @return [Hash]
def location_or_id
- @target == :external ? { :"r:id" => relationship.Id } : { :location => Axlsx::coder.encode(location) }
+ @target == :external ? { :"r:id" => relationship.Id } : { :location => Axlsx::coder.encode(location) }
end
end
end
diff --git a/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb b/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb
index 5d5a2186..5c49fdb3 100644
--- a/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb
@@ -26,7 +26,7 @@ module Axlsx
# seralize the collection of hyperlinks
# @return [String]
- def to_xml_string(str='')
+ def to_xml_string(str = '')
return if empty?
str << '<hyperlinks>'
each { |hyperlink| hyperlink.to_xml_string(str) }