spreadsheet 1.1.9 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +8 -0
- data/lib/spreadsheet.rb +1 -1
- data/lib/spreadsheet/worksheet.rb +8 -4
- data/test/worksheet.rb +21 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 153daf0819e113f6da9726a43b23494e30497ae3
|
4
|
+
data.tar.gz: 811ecec4ac2a63d3c431ed6dc324ff69c9a189ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bc43a69c6d5817d2132f05a9544546b070e5512c19c002aa7280ab2879a8b3f0297890f9bea890efe6a082b69a59a226313f4df47e4b5e65e7a08fb81ed894b
|
7
|
+
data.tar.gz: 2ea734d18f429276707f0823f2703cda52fcc057d6aa04eea4b065db1f08299c3f2a94fc4fb1b61fde2080d5a63fe479ecf857bc14d47d92fa7b1a1331537c02
|
data/History.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
### 1.2.0 17.2.2019
|
2
|
+
Author: James McLaren <jamesmclaren555@gmail.com>
|
3
|
+
* spreadsheet-1.2.0.gem released
|
4
|
+
|
5
|
+
### 1.1.9 26.1.2019
|
6
|
+
Author: Nick Weiland <nickweiland@gmail.com>
|
7
|
+
* spreadsheet-1.1.9.gem released.
|
8
|
+
|
1
9
|
### 1.1.8 / 20.08.2018
|
2
10
|
Author: VitaliyAdamkov <adamkov@tex.ua>
|
3
11
|
Date: Mon Aug 20 09:48:31 2018 +0300
|
data/lib/spreadsheet.rb
CHANGED
@@ -153,9 +153,13 @@ module Spreadsheet
|
|
153
153
|
# If the argument skip is given, #each iterates from that row until but
|
154
154
|
# omitting the first unused Row, effectively skipping the first _skip_ Rows
|
155
155
|
# from the top of the Worksheet.
|
156
|
-
def each
|
157
|
-
skip.upto(dimensions[1] - 1)
|
158
|
-
|
156
|
+
def each(skip=dimensions[0], &block)
|
157
|
+
rows = skip.upto(dimensions[1] - 1).map { |index| row(index) }.to_enum
|
158
|
+
|
159
|
+
if block_given?
|
160
|
+
rows.each(&block)
|
161
|
+
else
|
162
|
+
rows
|
159
163
|
end
|
160
164
|
end
|
161
165
|
def encoding # :nodoc:
|
@@ -314,7 +318,7 @@ module Spreadsheet
|
|
314
318
|
|
315
319
|
def compact!
|
316
320
|
recalculate_dimensions
|
317
|
-
|
321
|
+
|
318
322
|
# detect first non-nil non-empty row if given first row is empty or nil
|
319
323
|
if row(@dimensions[0]).empty? || row(@dimensions[0]).compact.join('').empty?
|
320
324
|
(@dimensions[0]...@dimensions[1]).each do |i|
|
data/test/worksheet.rb
CHANGED
@@ -108,18 +108,35 @@ module Spreadsheet
|
|
108
108
|
assert_equal 6, @book.formats.length
|
109
109
|
|
110
110
|
end
|
111
|
-
|
111
|
+
|
112
112
|
def test_freeze_panel!
|
113
113
|
assert_equal 0, @sheet.froze_top
|
114
114
|
assert_equal 0, @sheet.froze_left
|
115
115
|
assert_equal false, @sheet.has_frozen_panel?
|
116
|
-
|
116
|
+
|
117
117
|
@sheet.freeze!(2, 3)
|
118
118
|
assert_equal 2, @sheet.froze_top
|
119
119
|
assert_equal 3, @sheet.froze_left
|
120
120
|
assert_equal true, @sheet.has_frozen_panel?
|
121
|
-
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_each_with_skip
|
125
|
+
@sheet[0, 0] = 'foo'
|
126
|
+
@sheet[1, 0] = 'bar'
|
127
|
+
|
128
|
+
assert_equal @sheet.each(1).count, 1
|
129
|
+
assert_equal @sheet.each(1).first[0], 'bar'
|
122
130
|
end
|
123
|
-
|
131
|
+
|
132
|
+
def test_each_with_index
|
133
|
+
@sheet[0, 0] = 'foo'
|
134
|
+
@sheet[1, 0] = 'bar'
|
135
|
+
|
136
|
+
@sheet.each.with_index do |row, index|
|
137
|
+
assert_equal row[0], @sheet[index, 0]
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
124
141
|
end
|
125
142
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreadsheet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hannes F. Wyss, Masaomi Hatakeyama, Zeno R.R. Davatz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-ole
|