rspreadsheet 0.4.9 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/GUIDE.md +18 -2
- data/README.md +3 -10
- data/TROUBLESHOOTING.md +25 -0
- data/lib/helpers/class_extensions.rb +21 -15
- data/lib/rspreadsheet.rb +27 -4
- data/lib/rspreadsheet/empty_file_template.fods +9 -0
- data/lib/rspreadsheet/tools.rb +45 -3
- data/lib/rspreadsheet/version.rb +1 -1
- data/lib/rspreadsheet/workbook.rb +94 -46
- data/lib/rspreadsheet/worksheet.rb +0 -4
- data/spec/cell_spec.rb +6 -1
- data/spec/class_extensions_spec.rb +16 -3
- data/spec/fods_spec.rb +70 -0
- data/spec/rspreadsheet_spec.rb +22 -4
- data/spec/spec_helper.rb +1 -3
- data/spec/testfile1.fods +1039 -0
- data/spec/testfile1.ods +0 -0
- data/spec/tools_spec.rb +13 -0
- data/spec/worksheet_spec.rb +14 -0
- metadata +19 -7
data/spec/testfile1.ods
CHANGED
Binary file
|
data/spec/tools_spec.rb
CHANGED
@@ -13,6 +13,8 @@ describe Rspreadsheet::Tools do
|
|
13
13
|
@tools.convert_cell_address_to_coordinates('Zz1').should == [1,702]
|
14
14
|
@tools.a2c('AdA2').should == [2,781]
|
15
15
|
@tools.a2c('ADA','2').should == [2,781]
|
16
|
+
@tools.a2c('G','11').should == [11,7]
|
17
|
+
@tools.a2c(11, 'G').should == [11,7]
|
16
18
|
end
|
17
19
|
it 'converts correctly cell coordinates to adresses' do
|
18
20
|
@tools.convert_cell_coordinates_to_address([1,1]).should == 'A1'
|
@@ -34,6 +36,9 @@ describe Rspreadsheet::Tools do
|
|
34
36
|
expect{ @tools.a2c('A1A') }.to raise_error
|
35
37
|
expect{ @tools.a2c('1A11') }.to raise_error
|
36
38
|
expect{ @tools.a2c('1A11') }.to raise_error
|
39
|
+
expect{ @tools.a2c('F','G') }.to raise_error
|
40
|
+
expect{ @tools.a2c(5,'G1') }.to raise_error
|
41
|
+
expect{ @tools.a2c('G1',5) }.to raise_error
|
37
42
|
end
|
38
43
|
it 'converts correctly cell adresses given by components to coordinates' do
|
39
44
|
@tools.a2c('A','1').should eq [1,1]
|
@@ -46,4 +51,12 @@ describe Rspreadsheet::Tools do
|
|
46
51
|
@tools.a2c(21,'11.0').should eq [21,11]
|
47
52
|
@tools.a2c('23',22/2).should eq [23,11]
|
48
53
|
end
|
54
|
+
it 'can remove attributes from nodes' do
|
55
|
+
node = LibXML::XML::Node.new('a')
|
56
|
+
@tools.set_ns_attribute(node,'table','ref','123')
|
57
|
+
@tools.get_ns_attribute_value(node,'table','ref').should == '123'
|
58
|
+
@tools.remove_ns_attribute(node,'table','ref')
|
59
|
+
@tools.get_ns_attribute_value(node,'table','ref').should == nil
|
60
|
+
@tools.get_ns_attribute_value(node,'table','ref','nic').should == 'nic'
|
61
|
+
end
|
49
62
|
end
|
data/spec/worksheet_spec.rb
CHANGED
@@ -64,6 +64,7 @@ describe Rspreadsheet::Worksheet do
|
|
64
64
|
@sheet.cells('B2').value.should == 'test text'
|
65
65
|
@sheet.cells('B','2').value.should == 'test text'
|
66
66
|
@sheet.cells(2,'B').value.should == 'test text'
|
67
|
+
expect { @sheet.cells(2,'B',2) }.to raise_error
|
67
68
|
end
|
68
69
|
it 'makes Cell object accessible' do
|
69
70
|
@sheet.cells(1,1).value = 'test text'
|
@@ -101,5 +102,18 @@ describe Rspreadsheet::Worksheet do
|
|
101
102
|
@sheet.rows(-1).should == nil # return nil if configured to do so
|
102
103
|
Rspreadsheet.raise_on_negative_coordinates = pom # reset the setting back
|
103
104
|
end
|
105
|
+
it 'needs string or XMLNode on creation' do
|
106
|
+
expect { Rspreadsheet::Worksheet.new(1.2345) }.to raise_error
|
107
|
+
end
|
108
|
+
it 'returns correct number of rows' do
|
109
|
+
@sheet.first_unused_row_index.should == 1
|
110
|
+
@sheet[5,7] = 'text into cell'
|
111
|
+
@sheet.first_unused_row_index.should == 6
|
112
|
+
@sheet[995,7] = 'text into cell'
|
113
|
+
@sheet.first_unused_row_index.should == 996
|
114
|
+
end
|
115
|
+
it 'does not implement the "return all cells" function yet' do
|
116
|
+
expect { @sheet.cell }.to raise_error
|
117
|
+
end
|
104
118
|
end
|
105
119
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspreadsheet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakub A.Těšínský
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -42,30 +42,36 @@ dependencies:
|
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.5'
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '3'
|
48
51
|
type: :development
|
49
52
|
prerelease: false
|
50
53
|
version_requirements: !ruby/object:Gem::Requirement
|
51
54
|
requirements:
|
52
|
-
- - "
|
55
|
+
- - ">="
|
53
56
|
- !ruby/object:Gem::Version
|
54
57
|
version: '1.5'
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '3'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: rake
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
65
|
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0
|
67
|
+
version: '10.0'
|
62
68
|
type: :development
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
72
|
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0
|
74
|
+
version: '10.0'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: rspec
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -133,12 +139,14 @@ files:
|
|
133
139
|
- LICENSE.md
|
134
140
|
- README.md
|
135
141
|
- Rakefile
|
142
|
+
- TROUBLESHOOTING.md
|
136
143
|
- lib/helpers/class_extensions.rb
|
137
144
|
- lib/helpers/configuration.rb
|
138
145
|
- lib/rspreadsheet.rb
|
139
146
|
- lib/rspreadsheet/cell.rb
|
140
147
|
- lib/rspreadsheet/cell_format.rb
|
141
148
|
- lib/rspreadsheet/column.rb
|
149
|
+
- lib/rspreadsheet/empty_file_template.fods
|
142
150
|
- lib/rspreadsheet/empty_file_template.ods
|
143
151
|
- lib/rspreadsheet/image.rb
|
144
152
|
- lib/rspreadsheet/row.rb
|
@@ -155,6 +163,7 @@ files:
|
|
155
163
|
- spec/cell_spec.rb
|
156
164
|
- spec/class_extensions_spec.rb
|
157
165
|
- spec/column_spec.rb
|
166
|
+
- spec/fods_spec.rb
|
158
167
|
- spec/image_spec.rb
|
159
168
|
- spec/included_image_spec.rb
|
160
169
|
- spec/io_spec.rb
|
@@ -166,6 +175,7 @@ files:
|
|
166
175
|
- spec/test-image.png
|
167
176
|
- spec/testfile-issue-40.ods
|
168
177
|
- spec/testfile-issue-42-43.ods
|
178
|
+
- spec/testfile1.fods
|
169
179
|
- spec/testfile1.ods
|
170
180
|
- spec/testfile2-images.ods
|
171
181
|
- spec/tools_spec.rb
|
@@ -192,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
202
|
version: '0'
|
193
203
|
requirements: []
|
194
204
|
rubyforge_project:
|
195
|
-
rubygems_version: 2.
|
205
|
+
rubygems_version: 2.7.6.2
|
196
206
|
signing_key:
|
197
207
|
specification_version: 4
|
198
208
|
summary: Manipulating LibreOffice Calc (OpenDocument Spreadsheet) files from Ruby
|
@@ -202,6 +212,7 @@ test_files:
|
|
202
212
|
- spec/cell_spec.rb
|
203
213
|
- spec/class_extensions_spec.rb
|
204
214
|
- spec/column_spec.rb
|
215
|
+
- spec/fods_spec.rb
|
205
216
|
- spec/image_spec.rb
|
206
217
|
- spec/included_image_spec.rb
|
207
218
|
- spec/io_spec.rb
|
@@ -213,6 +224,7 @@ test_files:
|
|
213
224
|
- spec/test-image.png
|
214
225
|
- spec/testfile-issue-40.ods
|
215
226
|
- spec/testfile-issue-42-43.ods
|
227
|
+
- spec/testfile1.fods
|
216
228
|
- spec/testfile1.ods
|
217
229
|
- spec/testfile2-images.ods
|
218
230
|
- spec/tools_spec.rb
|