Skip to content

Commit 83e2398

Browse files
committed
chore(doc): document some members
1 parent b4bdbfa commit 83e2398

File tree

14 files changed

+59
-31
lines changed

14 files changed

+59
-31
lines changed

lib/axlsx/drawing/chart.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def d_lbls
5656
# Indicates that colors should be varied by datum
5757
# @return [Boolean]
5858
attr_reader :vary_colors
59-
59+
6060
# Configures the vary_colors options for this chart
6161
# @param [Boolean] v The value to set
6262
def vary_colors=(v) Axlsx::validate_boolean(v); @vary_colors = v; end
@@ -129,6 +129,8 @@ def title=(v)
129129
end
130130

131131
# The size of the Title object of the chart.
132+
# @param [String] v The size for the title object
133+
# @see Title
132134
def title_size=(v)
133135
@title.text_size = v unless v.to_s.empty?
134136
end

lib/axlsx/drawing/pic.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ def relationship
115115
end
116116

117117
# providing access to the anchor's width attribute
118-
# @param [Integer] v
119118
# @see OneCellAnchor.width
120119
def width
121120
return unless @anchor.is_a?(OneCellAnchor)
@@ -129,7 +128,6 @@ def width=(v)
129128
end
130129

131130
# providing access to update the anchor's height attribute
132-
# @param [Integer] v
133131
# @see OneCellAnchor.width
134132
# @note this is a noop if you are using a TwoCellAnchor
135133
def height

lib/axlsx/rels/relationships.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,17 @@ class Relationships < SimpleTypedList
1010
def initialize
1111
super Relationship
1212
end
13-
13+
1414
# The relationship instance for the given source object, or nil if none exists.
1515
# @see Relationship#source_obj
1616
# @return [Relationship]
1717
def for(source_obj)
1818
find{ |rel| rel.source_obj == source_obj }
1919
end
20-
20+
21+
# serialize relationships
22+
# @param [String] str
23+
# @return [String]
2124
def to_xml_string(str = '')
2225
str << '<?xml version="1.0" encoding="UTF-8"?>'
2326
str << ('<Relationships xmlns="' << RELS_R << '">')

lib/axlsx/util/constants.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,13 +385,16 @@ module Axlsx
385385
# @see http://www.codetable.net/asciikeycodes
386386
pattern = "\x0-\x08\x0B\x0C\x0E-\x1F"
387387
pattern = pattern.respond_to?(:encode) ? pattern.encode('UTF-8') : pattern
388-
388+
389389
# The regular expression used to remove control characters from worksheets
390390
CONTROL_CHARS = pattern.freeze
391-
391+
392+
# ISO 8601 date recognition
392393
ISO_8601_REGEX = /\A(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[0-1]|0[1-9]|[1-2][0-9])T(2[0-3]|[0-1][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?(Z|[+-](?:2[0-3]|[0-1][0-9]):[0-5][0-9])?\Z/.freeze
393-
394+
395+
# FLOAT recognition
394396
FLOAT_REGEX = /\A[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\Z/.freeze
395-
397+
398+
# Numeric recognition
396399
NUMERIC_REGEX = /\A[+-]?\d+?\Z/.freeze
397400
end

lib/axlsx/util/validators.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ def self.validate(name, types, v, other=false)
5656
raise ArgumentError, (ERR_TYPE % [v.inspect, name, types.inspect]) unless other.call(v)
5757
end
5858
v_class = v.is_a?(Class) ? v : v.class
59-
Array(types).each do |t|
59+
Array(types).each do |t|
6060
return if v_class <= t
6161
end
6262
raise ArgumentError, (ERR_TYPE % [v.inspect, name, types.inspect])
6363
end
6464
end
65-
65+
6666

6767
# Requires that the value can be converted to an integer
6868
# @para, [Any] v the value to validate
@@ -78,7 +78,8 @@ def self.validate_integerish(v)
7878
def self.validate_angle(v)
7979
raise ArgumentError, (ERR_ANGLE % v.inspect) unless (v.to_i >= -5400000 && v.to_i <= 5400000)
8080
end
81-
81+
82+
# Validates an unsigned intger
8283
UINT_VALIDATOR = lambda { |arg| arg.respond_to?(:>=) && arg >= 0 }
8384

8485
# Requires that the value is a Integer and is greater or equal to 0
@@ -148,7 +149,7 @@ def self.validate_cell_u(v)
148149
RestrictionValidator.validate "cell run style u", [:none, :single, :double, :singleAccounting, :doubleAccounting], v
149150
end
150151

151-
# validates cell style family which must be between 1 and 5
152+
# validates cell style family which must be between 1 and 5
152153
def self.validate_family(v)
153154
RestrictionValidator.validate "cell run style family", 1..5, v
154155
end

lib/axlsx/workbook/workbook.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,10 @@ def add_worksheet(options={})
280280
worksheet
281281
end
282282

283+
# Adds a new WorkbookView
284+
# @return WorkbookViews
285+
# @option options [Hash] options passed into the added WorkbookView
286+
# @see WorkbookView#initialize
283287
def add_view(options={})
284288
views << WorkbookView.new(options)
285289
end

lib/axlsx/workbook/workbook_view.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ class WorkbookView
3333

3434

3535
# Creates a new BookView object
36-
# @params [Hash] options A hash of key/value pairs that will be mapped to this instances attributes.
36+
# @param [Hash] options A hash of key/value pairs that will be mapped to this instances attributes.
3737
# @option [Symbol] visibility Specifies visible state of the workbook window. The default value for this attribute is :visible.
3838
# @option [Boolean] minimized Specifies a boolean value that indicates whether the workbook window is minimized.
3939
# @option [Boolean] show_horizontal_scroll Specifies a boolean value that indicates whether to display the horizontal scroll bar in the user interface.
4040
# @option [Boolean] show_vertical_scroll Specifies a boolean value that indicates whether to display the vertical scroll bar.
4141
# @option [Boolean] show_sheet_tabs Specifies a boolean value that indicates whether to display the sheet tabs in the user interface.
4242
# @option [Integer] tab_ratio Specifies ratio between the workbook tabs bar and the horizontal scroll bar.
4343
# @option [Integer] first_sheet Specifies the index to the first sheet in this book view.
44-
# @option [Integer] active_tab Specifies an unsignedInt that contains the index to the active sheet in this book view.
44+
# @option [Integer] active_tab Specifies an unsignedInt that contains the index to the active sheet in this book view.
4545
# @option [Integer] x_window Specifies the X coordinate for the upper left corner of the workbook window. The unit of measurement for this value is twips.
4646
# @option [Integer] y_window Specifies the Y coordinate for the upper left corner of the workbook window. The unit of measurement for this value is twips.
4747
# @option [Integer] window_width Specifies the width of the workbook window. The unit of measurement for this value is twips.
@@ -68,7 +68,9 @@ def initialize(options={})
6868
:show_sheet_tabs, :auto_filter_date_grouping
6969

7070

71-
71+
# Serialize the WorkbookView
72+
# @param [String] str
73+
# @return [String]
7274
def to_xml_string(str = '')
7375
str << '<workbookView '
7476
serialized_attributes str

lib/axlsx/workbook/worksheet/cell.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def initialize(row, value = nil, options = {})
6565
:shadow, :condense, :extend, :u,
6666
:vertAlign, :sz, :color, :scheme].freeze
6767

68+
# An array of valid cell types
6869
CELL_TYPES = [:date, :time, :float, :integer, :richtext,
6970
:string, :boolean, :iso_8601, :text].freeze
7071

@@ -79,7 +80,7 @@ def style
7980
# @return [Row]
8081
attr_reader :row
8182

82-
# The cell's data type. Currently only six types are supported, :date, :time, :float, :integer, :string and :boolean.
83+
# The cell's data type.
8384
# Changing the type for a cell will recast the value into that type. If no type option is specified in the constructor, the type is
8485
# automatically determed.
8586
# @see Cell#cell_type_from_value
@@ -348,6 +349,8 @@ def name=(label)
348349
# returns the name of the cell
349350
attr_reader :name
350351

352+
# Attempts to determine the correct width for this cell's content
353+
# @return [Float]
351354
def autowidth
352355
return if is_formula? || value.nil?
353356
if contains_rich_text?

lib/axlsx/workbook/worksheet/cfvos.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ def initialize
88
super(Cfvo)
99
end
1010

11+
# Serialize the Cfvo object
12+
# @param [String] str
13+
# @return [String]
1114
def to_xml_string(str='')
1215
each { |cfvo| cfvo.to_xml_string(str) }
1316
end
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Axlsx
22

3-
# The cols class manages the col object used to manage column widths.
3+
# The cols class manages the col object used to manage column widths.
44
# This is where the magic happens with autowidth
55
class Cols < SimpleTypedList
66

@@ -10,11 +10,14 @@ def initialize(worksheet)
1010
@worksheet = worksheet
1111
end
1212

13+
# Serialize the Cols object
14+
# @param [String] str
15+
# @return [String]
1316
def to_xml_string(str = '')
1417
return if empty?
1518
str << '<cols>'
1619
each { |item| item.to_xml_string(str) }
17-
str << '</cols>'
20+
str << '</cols>'
1821
end
1922
end
2023
end

0 commit comments

Comments
 (0)