rspreadsheet 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.gitignore +3 -0
- data/.travis.yml +13 -0
- data/COPYING.txt +15 -0
- data/DEVEL_BLOG.md +22 -0
- data/GUIDE.md +28 -12
- data/Gemfile.lock +89 -0
- data/Guardfile +11 -0
- data/LICENSE.md +544 -0
- data/README.md +18 -12
- data/Rakefile +10 -1
- data/lib/class_extensions.rb +36 -0
- data/lib/rspreadsheet/cell.rb +47 -0
- data/lib/rspreadsheet/empty_file_template.ods +0 -0
- data/lib/rspreadsheet/row.rb +30 -0
- data/lib/rspreadsheet/version.rb +1 -1
- data/lib/rspreadsheet/workbook.rb +55 -0
- data/lib/rspreadsheet/worksheet.rb +112 -0
- data/lib/rspreadsheet.rb +10 -1
- data/rspreadsheet.gemspec +19 -3
- data/spec/rspreadsheet_spec.rb +154 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/testfile1.ods +0 -0
- metadata +148 -16
- data/LICENSE.txt +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 587955d52821df6027e5a5585c3b11ddda4e8612
|
4
|
+
data.tar.gz: ed1c87deafcc001da840c29f5fbab0ab5ee215ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc258fa3660d01c25f5670fe5e29e55cf9e49451cb3d55dd96356255fc9b22433f81b338abcb3da55d44659fa2e814659e1c379903ae15170a629687166715cd
|
7
|
+
data.tar.gz: f509167f9de879478bc49b56606132795163e7dfaf893acb89321f11a975ae2311245f48d881532e64c9b32b9270f0a63f881b346bf818052b2aecd91490939a
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
CHANGED
@@ -21,6 +21,7 @@ build/
|
|
21
21
|
/_yardoc/
|
22
22
|
/doc/
|
23
23
|
/rdoc/
|
24
|
+
.~lock*
|
24
25
|
|
25
26
|
## Environment normalisation:
|
26
27
|
/.bundle/
|
@@ -35,3 +36,5 @@ build/
|
|
35
36
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
36
37
|
.rvmrc
|
37
38
|
|
39
|
+
# specific to the project
|
40
|
+
/*.ods
|
data/.travis.yml
ADDED
data/COPYING.txt
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
rspreadsheet - Manipulating OpenDocument spreadsheets with Ruby.
|
2
|
+
|
3
|
+
Copyright (C) 2014 Jakub A.Těšínský
|
4
|
+
|
5
|
+
This program is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU General Public License as published by
|
7
|
+
the Free Software Foundation version 3 of the License.
|
8
|
+
|
9
|
+
This program is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU General Public License
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
data/DEVEL_BLOG.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
See [GUIDE.md#conventions] for syntax conventions.
|
2
|
+
|
3
|
+
## Ideas/wishlist
|
4
|
+
|
5
|
+
* Trying to make row Enumerable - perhaps skipping empty or undefined cells.
|
6
|
+
* Accessors for nonempty/defined cells.
|
7
|
+
* Maybe insted two syntaxes for accessing cell, we make both of them do the same and return Proxy object which would act either as value or cell.
|
8
|
+
* Allow any of these?
|
9
|
+
* book['Spring 2014'] in place of book.worksheets('Spring 2014')
|
10
|
+
|
11
|
+
## Developing this gem
|
12
|
+
|
13
|
+
### How to test
|
14
|
+
|
15
|
+
* by running <code>guard</code> in terminal you will get tested any changes as soon as they are summitted
|
16
|
+
|
17
|
+
|
18
|
+
### Automated utilities
|
19
|
+
|
20
|
+
* [travis-ci](https://travis-ci.org/gorn/rspreadsheet/jobs/25375065) provides automated testing
|
21
|
+
* [github](https://github.com/gorn/rspreadsheet) hosts the repository where you can get the code
|
22
|
+
* [coverals](https://coveralls.io/r/gorn/rspreadsheet) checks how well source is covered by tests
|
data/GUIDE.md
CHANGED
@@ -1,23 +1,34 @@
|
|
1
|
-
|
1
|
+
## Examples of advanced syntax
|
2
|
+
|
3
|
+
Examples of more advanced syntax follows
|
2
4
|
|
3
5
|
```ruby
|
4
6
|
require 'rspreadsheet'
|
5
7
|
|
6
|
-
book = Rspreadsheet
|
7
|
-
sheet book.create_worksheet 'Top icecreams'
|
8
|
+
book = Rspreadsheet.new
|
9
|
+
sheet = book.create_worksheet 'Top icecreams'
|
8
10
|
|
9
11
|
sheet[0,0] = 'My top 5'
|
10
|
-
sheet[0,0].
|
11
|
-
sheet[0,0]
|
12
|
-
p sheet[0,0].format.bold # => true
|
12
|
+
p sheet[0,0].class # => String
|
13
|
+
p sheet[0,0] # => "My top 5"
|
13
14
|
|
14
|
-
# These are all the same
|
15
|
+
# These are all the same values - alternative syntax
|
15
16
|
p sheet.A1
|
16
|
-
p sheet
|
17
|
-
p sheet.
|
18
|
-
p sheet.rows[0].cells[0]
|
19
|
-
|
20
|
-
|
17
|
+
p sheet[0,0]
|
18
|
+
p sheet.cells[0,0].value
|
19
|
+
p sheet.rows[0].cells[0].value
|
20
|
+
|
21
|
+
# How to inspect/manipulate the Cell object
|
22
|
+
sheet.cells[0,0] # => Rspreadsheet::Cell
|
23
|
+
sheet.cells[0,0].format
|
24
|
+
sheet.cells[0,0].format.size = 15
|
25
|
+
sheet.cells[0,0].format.weight = bold
|
26
|
+
p sheet.cells[0,0].format.bold? # => true
|
27
|
+
|
28
|
+
# There are the same assigmenents
|
29
|
+
sheet.A1 = value
|
30
|
+
sheet[0,0]= value
|
31
|
+
sheet.cells[0,0].value = value
|
21
32
|
|
22
33
|
p sheet.A1.class # => Rspreadsheet::Cell
|
23
34
|
|
@@ -31,3 +42,8 @@ sheet.columns[1][1..3].format.color = :red
|
|
31
42
|
book.save
|
32
43
|
|
33
44
|
```
|
45
|
+
## Conventions
|
46
|
+
* with numeric coordinates row always comes before col as in [row,col]
|
47
|
+
* with alphanumerical col always comes before row as in F12
|
48
|
+
* Shorter syntax worksheet[x,y] returns value, longer syntax worksheet.cells[x,y] return cell objects. This allows to work conviniently with values using short syntax and access the cell object if needed (for formatting for example).
|
49
|
+
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rspreadsheet (0.0.2)
|
5
|
+
andand (~> 1.3)
|
6
|
+
libxml-ruby (~> 2.7)
|
7
|
+
rubyzip (~> 1.1)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
andand (1.3.3)
|
13
|
+
celluloid (0.15.2)
|
14
|
+
timers (~> 1.1.0)
|
15
|
+
coderay (1.1.0)
|
16
|
+
coveralls (0.7.0)
|
17
|
+
multi_json (~> 1.3)
|
18
|
+
rest-client
|
19
|
+
simplecov (>= 0.7)
|
20
|
+
term-ansicolor
|
21
|
+
thor
|
22
|
+
diff-lcs (1.2.5)
|
23
|
+
docile (1.1.3)
|
24
|
+
ffi (1.9.3)
|
25
|
+
formatador (0.2.4)
|
26
|
+
guard (2.6.1)
|
27
|
+
formatador (>= 0.2.4)
|
28
|
+
listen (~> 2.7)
|
29
|
+
lumberjack (~> 1.0)
|
30
|
+
pry (>= 0.9.12)
|
31
|
+
thor (>= 0.18.1)
|
32
|
+
guard-rspec (2.6.0)
|
33
|
+
guard (>= 1.8)
|
34
|
+
rspec (~> 2.13)
|
35
|
+
libxml-ruby (2.7.0)
|
36
|
+
listen (2.7.5)
|
37
|
+
celluloid (>= 0.15.2)
|
38
|
+
rb-fsevent (>= 0.9.3)
|
39
|
+
rb-inotify (>= 0.9)
|
40
|
+
lumberjack (1.0.5)
|
41
|
+
method_source (0.8.2)
|
42
|
+
mime-types (2.2)
|
43
|
+
multi_json (1.10.0)
|
44
|
+
notifier (0.5.0)
|
45
|
+
pry (0.9.12.6)
|
46
|
+
coderay (~> 1.0)
|
47
|
+
method_source (~> 0.8)
|
48
|
+
slop (~> 3.4)
|
49
|
+
rake (0.9.6)
|
50
|
+
rb-fsevent (0.9.4)
|
51
|
+
rb-inotify (0.9.4)
|
52
|
+
ffi (>= 0.5.0)
|
53
|
+
rest-client (1.6.7)
|
54
|
+
mime-types (>= 1.16)
|
55
|
+
rspec (2.14.1)
|
56
|
+
rspec-core (~> 2.14.0)
|
57
|
+
rspec-expectations (~> 2.14.0)
|
58
|
+
rspec-mocks (~> 2.14.0)
|
59
|
+
rspec-core (2.14.8)
|
60
|
+
rspec-expectations (2.14.5)
|
61
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
62
|
+
rspec-mocks (2.14.6)
|
63
|
+
rubyzip (1.1.4)
|
64
|
+
simplecov (0.8.2)
|
65
|
+
docile (~> 1.1.0)
|
66
|
+
multi_json
|
67
|
+
simplecov-html (~> 0.8.0)
|
68
|
+
simplecov-html (0.8.0)
|
69
|
+
slop (3.5.0)
|
70
|
+
term-ansicolor (1.3.0)
|
71
|
+
tins (~> 1.0)
|
72
|
+
test_notifier (2.0.2)
|
73
|
+
notifier
|
74
|
+
thor (0.19.1)
|
75
|
+
timers (1.1.0)
|
76
|
+
tins (1.3.0)
|
77
|
+
|
78
|
+
PLATFORMS
|
79
|
+
ruby
|
80
|
+
|
81
|
+
DEPENDENCIES
|
82
|
+
bundler (~> 1.5)
|
83
|
+
coveralls (~> 0.7)
|
84
|
+
guard (~> 2.6)
|
85
|
+
guard-rspec (~> 2.6)
|
86
|
+
rake (~> 0.9)
|
87
|
+
rspec (~> 2)
|
88
|
+
rspreadsheet!
|
89
|
+
test_notifier (~> 2.0)
|