spreadsheet_goodies 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 179fded79581bca98e1f46e8773d57eef7c37339
|
4
|
+
data.tar.gz: fe362c12b5c63564b34d93a0a8d43678929e56ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb5663b69d10c0c2f85c1d844e4db62615ffd2401cd0d98d95c0f5f6c61bfb6a0e3a15d9832ef7b1d250791d03a93667572b8f39debc56b65ba8fb1196bd7ad0
|
7
|
+
data.tar.gz: c3f50a46110f3360a776b5f215f27ec97f27d7c4de9cff4e7659d1438b9318d9c70b6105132990804481a6784b51e5310e19ef51aca52edf7ae0efa9ce0c0d22
|
@@ -16,7 +16,7 @@ module SpreadsheetGoodies::Excel
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def add_worksheet(sheet_name)
|
19
|
-
@current_sheet =
|
19
|
+
@current_sheet = workbook.add_worksheet(name: sheet_name)
|
20
20
|
setup_current_sheet_styles
|
21
21
|
freeze_top_row
|
22
22
|
@current_sheet
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module SpreadsheetGoodies
|
2
2
|
|
3
|
-
|
4
|
-
#
|
5
|
-
# o título da coluna como índice. Ex: row['Data formal do pedido']
|
3
|
+
# Override Array#[] and Array#[]= to allow indexing by the column title.
|
4
|
+
# E.g.: row['Employee name']
|
6
5
|
class Row < Array
|
7
6
|
attr_reader :header_row, :row_number, :parent_worksheet
|
8
7
|
|
@@ -14,20 +13,32 @@ module SpreadsheetGoodies
|
|
14
13
|
end
|
15
14
|
|
16
15
|
def [](locator)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
if locator.is_a?(String)
|
17
|
+
if column_index = @header_row.find_index(locator)
|
18
|
+
super(column_index) # queries local cache only
|
19
|
+
else
|
20
|
+
raise "Column with title '#{locator}' does not exist in header row"
|
21
|
+
end
|
22
|
+
else
|
23
|
+
super(locator) # queries local cache only
|
24
|
+
end
|
21
25
|
end
|
22
26
|
|
23
27
|
def []=(locator, value)
|
24
|
-
|
28
|
+
if locator.is_a?(String)
|
29
|
+
column_index = @header_row.find_index(locator)
|
30
|
+
if column_index.nil?
|
31
|
+
raise "Column with title '#{locator}' does not exist in header row"
|
32
|
+
end
|
33
|
+
else
|
34
|
+
column_index = locator
|
35
|
+
end
|
25
36
|
|
26
37
|
# propagates change to real worksheet
|
27
|
-
@parent_worksheet.write_to_cell(@row_number,
|
38
|
+
@parent_worksheet.write_to_cell(@row_number, column_index+1, value)
|
28
39
|
|
29
40
|
# updates local cache
|
30
|
-
super(
|
41
|
+
super(column_index, value)
|
31
42
|
end
|
32
43
|
end
|
33
44
|
end
|
data/spreadsheet_goodies.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |gemspec|
|
|
16
16
|
"on other gems to do the actual work of reading and writing to " +
|
17
17
|
"spreadsheet documents. It main features are:"
|
18
18
|
" * Read a spreadseet to an array of arrays, to allow accessing its data " +
|
19
|
-
" without using the original document"
|
19
|
+
" without using the original document/file/object"
|
20
20
|
" * Access a row's elements using the column titles as keys"
|
21
21
|
gemspec.homepage = 'https://github.com/ricardo-jasinski/spreadsheet_goodies'
|
22
22
|
gemspec.license = 'Unlicense'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreadsheet_goodies
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo Jasinski
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -166,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
166
|
version: '0'
|
167
167
|
requirements: []
|
168
168
|
rubyforge_project:
|
169
|
-
rubygems_version: 2.6.
|
169
|
+
rubygems_version: 2.6.6
|
170
170
|
signing_key:
|
171
171
|
specification_version: 4
|
172
172
|
summary: SpreadsheetGoodies is a collection of tools to help work with Excel and Google
|