summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/workbook
diff options
context:
space:
mode:
authorZsolt Kozaroczy <[email protected]>2023-05-31 17:19:35 +0200
committerGitHub <[email protected]>2023-05-31 17:19:35 +0200
commitad87c51bf8c8f59a36514bb95dc6d3a582c6b2fd (patch)
tree1a666e99ccebefa4be1df5655b96f9f1337df794 /lib/axlsx/workbook
parentcbcf330ea266c96861e4029aaea6be1063862900 (diff)
parent42594ea9e486d3b0fe9c84ba1fc59140bb59439f (diff)
downloadcaxlsx-ad87c51bf8c8f59a36514bb95dc6d3a582c6b2fd.tar.gz
caxlsx-ad87c51bf8c8f59a36514bb95dc6d3a582c6b2fd.zip
Merge pull request #270 from tagliala/chore/use-ruby-19-hash-syntax
Use Ruby 1.9 hash syntax
Diffstat (limited to 'lib/axlsx/workbook')
-rw-r--r--lib/axlsx/workbook/worksheet/cell.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/data_bar.rb6
-rw-r--r--lib/axlsx/workbook/worksheet/icon_set.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/pivot_table.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/protected_ranges.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/rich_text_run.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/row.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/row_breaks.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/sheet_pr.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/sheet_view.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet.rb6
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb4
15 files changed, 27 insertions, 27 deletions
diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb
index b4f826c2..f651e3cb 100644
--- a/lib/axlsx/workbook/worksheet/cell.rb
+++ b/lib/axlsx/workbook/worksheet/cell.rb
@@ -299,7 +299,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
diff --git a/lib/axlsx/workbook/worksheet/col_breaks.rb b/lib/axlsx/workbook/worksheet/col_breaks.rb
index 58fe9e10..cc7d6abb 100644
--- a/lib/axlsx/workbook/worksheet/col_breaks.rb
+++ b/lib/axlsx/workbook/worksheet/col_breaks.rb
@@ -16,7 +16,7 @@ module Axlsx
# Break will be passed to the created break object.
# @see Break
def add_break(options)
- self << Break.new(options.merge(:max => 1048575, :man => true))
+ self << Break.new(options.merge(max: 1048575, man: true))
last
end
diff --git a/lib/axlsx/workbook/worksheet/color_scale.rb b/lib/axlsx/workbook/worksheet/color_scale.rb
index fb84668b..e48de3bb 100644
--- a/lib/axlsx/workbook/worksheet/color_scale.rb
+++ b/lib/axlsx/workbook/worksheet/color_scale.rb
@@ -12,8 +12,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
@@ -31,9 +31,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
@@ -68,9 +68,9 @@ module Axlsx
# @option [Any] val The value of the cfvo to add
# @option [String] The rgb color for the cfvo
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 }
+ 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 }
end
# removes the cfvo and color pair at the index specified.
diff --git a/lib/axlsx/workbook/worksheet/comment.rb b/lib/axlsx/workbook/worksheet/comment.rb
index ea8324d0..879e6960 100644
--- a/lib/axlsx/workbook/worksheet/comment.rb
+++ b/lib/axlsx/workbook/worksheet/comment.rb
@@ -81,7 +81,7 @@ module Axlsx
# by default, all columns are 5 columns wide and 5 rows high
def initialize_vml_shape
pos = Axlsx::name_to_indices(ref)
- @vml_shape = VmlShape.new(:row => pos[1], :column => pos[0], :visible => @visible) do |vml|
+ @vml_shape = VmlShape.new(row: pos[1], column: pos[0], visible: @visible) do |vml|
vml.left_column = vml.column
vml.right_column = vml.column + 2
vml.top_row = vml.row
diff --git a/lib/axlsx/workbook/worksheet/data_bar.rb b/lib/axlsx/workbook/worksheet/data_bar.rb
index 0dcdc8a8..74158d98 100644
--- a/lib/axlsx/workbook/worksheet/data_bar.rb
+++ b/lib/axlsx/workbook/worksheet/data_bar.rb
@@ -14,8 +14,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
@@ -72,7 +72,7 @@ module Axlsx
# the color object used in the data bar formatting
# @return [Color]
def color
- @color ||= Color.new :rgb => "FF0000FF"
+ @color ||= Color.new rgb: "FF0000FF"
end
# @see minLength
diff --git a/lib/axlsx/workbook/worksheet/icon_set.rb b/lib/axlsx/workbook/worksheet/icon_set.rb
index c4b5f2ff..59d67e28 100644
--- a/lib/axlsx/workbook/worksheet/icon_set.rb
+++ b/lib/axlsx/workbook/worksheet/icon_set.rb
@@ -75,7 +75,7 @@ module Axlsx
# I am keeping this private for now as I am not sure what impact changes to the required two cfvo objects will do.
def initialize_value_objects
@value_objects = SimpleTypedList.new Cfvo
- @value_objects.concat [Cfvo.new(:type => :percent, :val => 0), Cfvo.new(:type => :percent, :val => 33), Cfvo.new(:type => :percent, :val => 67)]
+ @value_objects.concat [Cfvo.new(type: :percent, val: 0), Cfvo.new(type: :percent, val: 33), Cfvo.new(type: :percent, val: 67)]
@value_objects.lock
end
end
diff --git a/lib/axlsx/workbook/worksheet/pivot_table.rb b/lib/axlsx/workbook/worksheet/pivot_table.rb
index 44a50f19..a75842cd 100644
--- a/lib/axlsx/workbook/worksheet/pivot_table.rb
+++ b/lib/axlsx/workbook/worksheet/pivot_table.rb
@@ -124,7 +124,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
diff --git a/lib/axlsx/workbook/worksheet/protected_ranges.rb b/lib/axlsx/workbook/worksheet/protected_ranges.rb
index f8ce82c5..b425d053 100644
--- a/lib/axlsx/workbook/worksheet/protected_ranges.rb
+++ b/lib/axlsx/workbook/worksheet/protected_ranges.rb
@@ -21,7 +21,7 @@ module Axlsx
elsif cells.is_a?(SimpleTypedList) || cells.is_a?(Array)
Axlsx::cell_range(cells, false)
end
- self << ProtectedRange.new(:sqref => sqref, :name => "Range#{size}")
+ self << ProtectedRange.new(sqref: sqref, name: "Range#{size}")
last
end
diff --git a/lib/axlsx/workbook/worksheet/rich_text_run.rb b/lib/axlsx/workbook/worksheet/rich_text_run.rb
index e3522d4c..9f66959a 100644
--- a/lib/axlsx/workbook/worksheet/rich_text_run.rb
+++ b/lib/axlsx/workbook/worksheet/rich_text_run.rb
@@ -140,7 +140,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
diff --git a/lib/axlsx/workbook/worksheet/row.rb b/lib/axlsx/workbook/worksheet/row.rb
index dc0320b7..0b25fc59 100644
--- a/lib/axlsx/workbook/worksheet/row.rb
+++ b/lib/axlsx/workbook/worksheet/row.rb
@@ -89,7 +89,7 @@ module Axlsx
# @param [String] str The string this rows xml will be appended to.
# @return [String]
def to_xml_string(r_index, str = +'')
- serialized_tag('row', str, :r => Axlsx.row_ref(r_index)) do
+ serialized_tag('row', str, r: Axlsx.row_ref(r_index)) do
each_with_index { |cell, c_index| cell.to_xml_string(r_index, c_index, str) }
end
end
diff --git a/lib/axlsx/workbook/worksheet/row_breaks.rb b/lib/axlsx/workbook/worksheet/row_breaks.rb
index 21691f7a..381dc0b6 100644
--- a/lib/axlsx/workbook/worksheet/row_breaks.rb
+++ b/lib/axlsx/workbook/worksheet/row_breaks.rb
@@ -14,7 +14,7 @@ module Axlsx
# @see Break
def add_break(options)
# force feed the Excel default
- self << Break.new(options.merge(:max => 16383, :man => true))
+ self << Break.new(options.merge(max: 16383, man: true))
last
end
diff --git a/lib/axlsx/workbook/worksheet/sheet_pr.rb b/lib/axlsx/workbook/worksheet/sheet_pr.rb
index ea191fa0..0676170e 100644
--- a/lib/axlsx/workbook/worksheet/sheet_pr.rb
+++ b/lib/axlsx/workbook/worksheet/sheet_pr.rb
@@ -75,7 +75,7 @@ module Axlsx
# @see tab_color
def tab_color=(v)
- @tab_color = Color.new(:rgb => v)
+ @tab_color = Color.new(rgb: v)
end
private
diff --git a/lib/axlsx/workbook/worksheet/sheet_view.rb b/lib/axlsx/workbook/worksheet/sheet_view.rb
index b64920bb..6138cbf7 100644
--- a/lib/axlsx/workbook/worksheet/sheet_view.rb
+++ b/lib/axlsx/workbook/worksheet/sheet_view.rb
@@ -158,7 +158,7 @@ module Axlsx
# param [Hash] options
# return [Selection]
def add_selection(pane, options = {})
- @selections[pane] = Selection.new(options.merge(:pane => pane))
+ @selections[pane] = Selection.new(options.merge(pane: pane))
end
# @see color_id
diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb
index 1ece3138..90461c66 100644
--- a/lib/axlsx/workbook/worksheet/worksheet.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet.rb
@@ -448,7 +448,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
@@ -531,9 +531,9 @@ module Axlsx
cell.pos
end
if column_index > 0
- col_breaks.add_break(:id => column_index)
+ col_breaks.add_break(id: column_index)
end
- row_breaks.add_break(:id => row_index)
+ row_breaks.add_break(id: row_index)
end
# This is a helper method that Lets you specify a fixed width for multiple columns in a worksheet in one go.
diff --git a/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb b/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb
index c4cb8983..80f7ba09 100644
--- a/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb
@@ -52,7 +52,7 @@ module Axlsx
def relationship
return unless @target == :external
- Relationship.new(self, HYPERLINK_R, location, :target_mode => :External)
+ Relationship.new(self, HYPERLINK_R, location, target_mode: :External)
end
# Seralize the object
@@ -69,7 +69,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