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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd771f6375c227ea8e847dd9baa0b8c594ee094b
4
- data.tar.gz: d9ddedd561cfd67ab9784326aaad2bb0fd5877f7
3
+ metadata.gz: 153daf0819e113f6da9726a43b23494e30497ae3
4
+ data.tar.gz: 811ecec4ac2a63d3c431ed6dc324ff69c9a189ca
5
5
  SHA512:
6
- metadata.gz: faf0102464aa6c38ed4c62052777e2acfdd2d463764a4d20a1aa51f7de3937685dc242f202e267a4e26ea52c9eb37b9cacc0a53e394323a16391ecce3da0e0fe
7
- data.tar.gz: cdfa1580f3f6d47adb8bbe70c9d505660cf213b5d632526455de14d76c4ba5041e56aae2b755e3f5781a3464bc709b698fe44f46ef686a5b34612272467fa291
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
@@ -46,7 +46,7 @@ module Spreadsheet
46
46
 
47
47
  ##
48
48
  # The version of Spreadsheet you are using.
49
- VERSION = '1.1.9'
49
+ VERSION = '1.2.0'
50
50
 
51
51
  ##
52
52
  # Default client Encoding. Change this value if your application uses a
@@ -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 skip=dimensions[0]
157
- skip.upto(dimensions[1] - 1) do |idx|
158
- yield row(idx)
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|
@@ -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.1.9
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-01-26 00:00:00.000000000 Z
11
+ date: 2019-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-ole