Skip to content

Commit d64af4a

Browse files
committed
fixing yarddoc
1 parent 57e0960 commit d64af4a

File tree

12 files changed

+80
-43
lines changed

12 files changed

+80
-43
lines changed

.yardoc/checksums

+37-21
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,38 @@
1-
lib/workbook.rb 32bc69df4e3b8ce2c9268de044456cac6a0bee40
2-
lib/workbook/row.rb 2ebac27abd51f4858c99c20eaaa51c146820edaf
3-
lib/workbook/cell.rb e9e8375f8ca39b2d48087d362a894ab41768ea77
4-
lib/workbook/book.rb 4975414f7982cf0cc30494e209886057c9d4c750
5-
lib/workbook/sheet.rb 6e4dd25a20aa38932a202bc108de9c4fe99a1d2b
6-
lib/workbook/table.rb f09a6978e9aeb990b66117906de83fc1c10d1f0c
7-
lib/workbook/format.rb 2c851e82a2c6b3b7c165d005824d9c0b6eadfa7c
8-
lib/workbook/version.rb 96df0e31463de68e584e54d3a568988045c08e32
9-
lib/workbook/template.rb 17d4443a02dab1e7373e0d4ee5d5bb598afbb2f2
10-
lib/workbook/nil_value.rb 6dd69760293023adf43fb0a8b6cef65f48b0662f
11-
lib/workbook/readers/csv_reader.rb b04c6dc423a30a87ae957a01229778543840654f
12-
lib/workbook/readers/xls_reader.rb a42b30bc31731c01c23367450306f849b7b36791
13-
lib/workbook/readers/ods_reader.rb 8094776c94e46dfb0fb1f293f3e8618692b61e59
14-
lib/workbook/writers/xls_writer.rb ca52cf9c5c11d1768a96ec33ca48b1f68a59b559
15-
lib/workbook/readers/txt_reader.rb d954decd6be2b2c7ab7ad60fe68398c428d077cd
16-
lib/workbook/readers/xls_shared.rb 67da0f89a3b387b6d575df42a3e49f8a53fae49d
17-
lib/workbook/readers/xlsx_reader.rb 562e664987a4936d9abf89ecb8098744fbb81cf3
1+
lib/workbook.rb 6438570227f4d8db697a8f875c80e4c1334e99c7
2+
lib/workbook/row.rb f10c777f11bcf7a03f76615f794ee5730991b097
3+
lib/workbook/book.rb 0ce5e14b5fabe87cf92a2e09a30779edd5dc2248
4+
lib/workbook/cell.rb cac1d4b1e42b44059b938ca8b0e521d8fdd002be
5+
lib/workbook/sheet.rb 5e43246f9fec4db953d6053af8e5b8b16af8ca50
6+
lib/workbook/table.rb 41cd6aded7748689e9de425e2afd5bc8635c0a5a
7+
lib/workbook/format.rb 8e8f8c5bd0c9a44d03dd6f4bd787aeb19759688c
8+
lib/workbook/column.rb 78a5da45e87afea1c489a4fb666e8d923179570b
9+
lib/workbook/version.rb 020f173233dcaadd7a6f90753bcbc6ab5b8b25cc
10+
lib/workbook/template.rb 714cf57b0ac43fc020f9bf123d11b5d870851deb
11+
lib/workbook/types/nil.rb da39a3ee5e6b4b0d3255bfef95601890afd80709
12+
lib/workbook/nil_value.rb e773e3b95466dc0ef907ea187e692a82f9752764
13+
lib/workbook/types/date.rb 1f6cd471a88c6a03b02dda54bfa86e70c914d612
14+
lib/workbook/types/time.rb b7a4c25a9236ff9bfea79334c8c7b126ad98177a
15+
lib/workbook/types/true.rb da39a3ee5e6b4b0d3255bfef95601890afd80709
16+
lib/workbook/types/false.rb da39a3ee5e6b4b0d3255bfef95601890afd80709
17+
lib/workbook/types/string.rb 7d9138192f5b597027a1e6039d0e4d24732b32c5
18+
lib/workbook/modules/cell.rb 336687a768edc50e5dcf056c775cd052b7257220
19+
lib/workbook/generatetypes.rb ed30aeac0037757d9fd170962440b4c31ea35ba5
20+
lib/workbook/types/numeric.rb cc3b3c332d3fd714aac2f61cd1b297461a177121
21+
lib/workbook/modules/cache.rb 4f493b5da9725b1dba8b0d4c5e50f260cbe71846
22+
lib/workbook/types/nil_class.rb bde80579120dda2ea26006ebd213a9f5806b34fe
23+
lib/workbook/types/true_class.rb 58426c452b1146f9c7f466817c5a34c5d87bf8bf
24+
lib/workbook/types/false_class.rb b462a69a094c0ad7a694de1c3ca8868486a10f24
25+
lib/workbook/modules/diff_sort.rb 2d634c089d2dd98cca57a90e62fa6d8b5adf876d
26+
lib/workbook/readers/xls_reader.rb 9993723162e63a372f44fbdffeadf779a7c99ec5
27+
lib/workbook/readers/ods_reader.rb 15d6203b19c86dd735d46f7f2e98e3d1cbaaacfc
28+
lib/workbook/readers/csv_reader.rb faa57ea04511f22d2e111f358aac9291dbe17acd
29+
lib/workbook/writers/xls_writer.rb cca4a524506e04dfe23d60fb364e7878a8f5120f
30+
lib/workbook/readers/txt_reader.rb 65a16f46aac4debcfe4aab45494de87d785f5ae2
31+
lib/workbook/readers/xls_shared.rb 4cb1a5cc897a2578bb5ba02eaceccda01627dc34
1832
lib/workbook/modules/type_parser.rb a933dd8ba9566c13cd61999ada9ffb431c402444
19-
lib/workbook/writers/html_writer.rb 0671601948122a46e9ea7cd0888378256560f6f9
20-
lib/workbook/modules/table_diff_sort.rb cffe0ffc3cd71d79ea8fcd67fad363b63292c005
21-
lib/workbook/writers/csv_table_writer.rb 9ea2161c399c37a172b6a4a95dcaefc95ab47ece
22-
lib/workbook/modules/raw_objects_storage.rb 3b9a499c170f1e82a2750dbfa247b4a1c2eb0e20
33+
lib/workbook/writers/html_writer.rb 44adc88d7faa0e09d3684d005473069149503d0e
34+
lib/workbook/readers/xlsx_reader.rb 632564692d893df9968828380bcab15a0a90ea47
35+
lib/workbook/writers/xlsx_writer.rb ea165031771b18e48c34863a48de05a667546d3a
36+
lib/workbook/writers/csv_table_writer.rb 76018a0d9ed6140ee2a639edbc821c9754a8accc
37+
lib/workbook/writers/json_table_writer.rb 5b3f503afd1a1a5dd410ba12f66ad66711621cb2
38+
lib/workbook/modules/raw_objects_storage.rb edc0d117f776f1d05c81bdd0fe7c22bdee247596

.yardoc/object_types

3.45 KB
Binary file not shown.

.yardoc/objects/root.dat

53.1 KB
Binary file not shown.

lib/workbook/format.rb

+13-1
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,26 @@
33

44
module Workbook
55
# Format is an object used for maintinaing a cell's formatting. It can belong to many cells. It maintains a relation to the raw template's equivalent, to preserve attributes Workbook cannot modify/access.
6+
# The keys in the Hash are intended to closely mimick the CSS-style options:
7+
#
8+
# {
9+
# background_color: '#ff000',
10+
# color: '#ffff00',
11+
# font_weight: :bold,
12+
# text_decoration: :underline,
13+
# }
14+
#
15+
# Note that as we speak, not all exporters support all properties properly. Consider it WIP.
616
class Format < Hash
717
include Workbook::Modules::RawObjectsStorage
818
alias_method :merge_hash, :merge
919
alias_method :merge_hash!, :merge!
1020
attr_accessor :name, :parent
1121

12-
# Initialize
22+
# Initializes Workbook::Format with a hash. The keys in the Hash are intended to closely mimick the CSS-style options (see above)
23+
#
1324
# @param [Workbook::Format, Hash] options (e.g. :background, :color, :background_color, :font_weight (integer or css-type labels)
25+
# @return [String] the name of the format, default: nil
1426
def initialize options={}, name=nil
1527
options.each {|k,v| self[k]=v}
1628
self.name = name

lib/workbook/modules/cell.rb

+9-6
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def template
102102

103103
# Change the current format
104104
#
105-
# @param [Workbook::Format, Hash] f set the formatting properties of this Cell
105+
# @param [Workbook::Format, Hash] f set the formatting properties of this Cell, see Workbook::Format#initialize
106106
def format= f
107107
if f.is_a? Workbook::Format
108108
@workbook_format = f
@@ -115,7 +115,7 @@ def format= f
115115

116116
# Returns current format
117117
#
118-
# @returns [Workbook::Format] the current format
118+
# @return [Workbook::Format] the current format
119119
def format
120120
# return @workbook_format if @workbook_format
121121
if row and template and row.header? and !@workbook_format
@@ -211,8 +211,9 @@ def to_sym
211211
end
212212

213213
# Compare
214+
#
214215
# @param [Workbook::Cell] other cell to compare against (based on value), can compare different value-types using #compare_on_class
215-
# @returns [Fixnum] -1, 0, 1
216+
# @return [Fixnum] -1, 0, 1
216217
def <=> other
217218
rv = nil
218219
begin
@@ -224,7 +225,6 @@ def <=> other
224225
rv = compare_on_class other
225226
end
226227
return rv
227-
228228
end
229229

230230
# Compare on class level
@@ -248,20 +248,23 @@ def importance_of_class value
248248
return nil
249249
end
250250

251+
# Returns whether special formatting is present on this cell
252+
#
253+
# @return [Boolean] index of the cell
251254
def format?
252255
format and format.keys.count > 0
253256
end
254257

255258
# Returns the index of the cell within the row, returns nil if no row is present
256259
#
257-
# @returns [Integer, NilClass] index of the cell
260+
# @return [Integer, NilClass] index of the cell
258261
def index
259262
row.index self if row
260263
end
261264

262265
# Returns the key (a Symbol) of the cell, based on its table's header
263266
#
264-
# @returns [Symbol, NilClass] key of the cell, returns nil if the cell doesn't belong to a table
267+
# @return [Symbol, NilClass] key of the cell, returns nil if the cell doesn't belong to a table
265268
def key
266269
table.header[index].to_sym if table
267270
end

lib/workbook/modules/raw_objects_storage.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def remove_all_raws!
2828
end
2929

3030
# Lists the classes for which raws are available
31-
# @return Array<Object> array with the classes available
31+
# @return [Array<Object>] array with the classes available
3232
def available_raws
3333
raws.keys
3434
end

lib/workbook/nil_value.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Workbook
44
class NilValue
55

66
# initialize this special nilvalue with a reason
7-
# @params [String] reason (currently only :covered, in case this cell is coverd because an adjecant cell spans over it)
7+
# @param [String] reason (currently only :covered, in case this cell is coverd because an adjecant cell spans over it)
88
def initialize reason
99
self.reason= reason
1010
end

lib/workbook/readers/xls_shared.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module XlsShared
55

66
# Converts standard (ruby/C++/unix/...) strftime formatting to MS's formatting
77
#
8-
# @param [String, nil] numberformat (nil returns nil)
8+
# @param [String, nil] ms_nr_format (nil returns nil)
99
# @return [String, nil]
1010
def ms_formatting_to_strftime ms_nr_format
1111
if ms_nr_format

lib/workbook/sheet.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def table
3636

3737
# Returns the name of this sheet
3838
#
39-
# @return [String] the name, defaulting to "Sheet {index}" when none is set
39+
# @return [String] the name, defaulting to sheet#index when none is set
4040
def name
4141
@name ||= "Sheet #{book.index(self)+1}"
4242
end

lib/workbook/table.rb

+9-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def header
5555
# Set the header of this table (typically the first row, but can be a different row).
5656
# The header row is also used for finding values in a aribrary row.
5757
#
58-
# @param [Workbook::Row, Integer]
58+
# @param [Workbook::Row, Integer] h should be the row or the index of this table's row
5959
# @return [Workbook::Row] The header
6060
def header= h
6161
if h.is_a? Numeric
@@ -65,8 +65,11 @@ def header= h
6565
end
6666
end
6767

68-
def header_row_index(h=nil)
69-
self.index(h ? h : self.header)
68+
# Returns the index of the header row
69+
#
70+
# @return [Integer] The index of the header row (typically 0)
71+
def header_row_index
72+
self.index(self.header)
7073
end
7174

7275
def define_columns_with_row(r)
@@ -76,6 +79,9 @@ def define_columns_with_row(r)
7679
end
7780

7881
# Generates a new row, with optionally predefined cell-values, that is already connected to this table.
82+
#
83+
# @param [Array, Workbook::Row] cell_values is an array or row of cell values
84+
# @return [Workbook::Row] the newly created row
7985
def new_row cell_values=[]
8086
r = Workbook::Row.new(cell_values,self)
8187
return r

lib/workbook/writers/csv_table_writer.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ module Writers
66
module CsvTableWriter
77
# Output the current workbook to CSV format
88
#
9-
# @param [String] filename
109
# @param [Hash] options (not used)
1110
# @return [String] csv (comma separated values in a string)
1211
def to_csv options={}
@@ -23,7 +22,7 @@ def to_csv options={}
2322
end
2423
csv
2524
end
26-
25+
2726
# Write the current workbook to CSV format
2827
#
2928
# @param [String] filename

lib/workbook/writers/xlsx_writer.rb

+7-6
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,12 @@ def formats_to_xlsx_format
8989
end
9090
end
9191

92+
def make_sure_f_is_a_workbook_format f
93+
f.is_a?(Workbook::Format) ? f : Workbook::Format.new(f)
94+
end
95+
9296
def format_to_xlsx_format f
93-
xlsfmt = nil
94-
unless f.is_a? Workbook::Format
95-
f = Workbook::Format.new f
96-
end
97+
f = make_sure_f_is_a_workbook_format f
9798

9899
xlsfmt={}
99100
xlsfmt[:fg_color] = "FF#{f[:color].to_s.upcase}".gsub("#",'') if f[:color]
@@ -104,10 +105,10 @@ def format_to_xlsx_format f
104105
xlsfmt[:format_code] = strftime_to_ms_format(f[:number_format]) if f[:number_format]
105106
xlsfmt[:font_name] = f[:font_family].split.first if f[:font_family]
106107
xlsfmt[:family] = parse_font_family(f) if f[:font_family]
107-
f.add_raw init_xlsx_spreadsheet_template.workbook.styles.add_style(xlsfmt)
108-
# wb.styles{|a| p a.add_style({}).class }
109108

109+
f.add_raw init_xlsx_spreadsheet_template.workbook.styles.add_style(xlsfmt)
110110
f.add_raw xlsfmt
111+
111112
return xlsfmt
112113
end
113114
end

0 commit comments

Comments
 (0)